fix
This commit is contained in:
parent
ed0a41acaf
commit
b6ce63cfa9
@ -1,17 +1,9 @@
|
|||||||
import "module-alias/register";
|
import "module-alias/register";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { Container } from "typedi";
|
import { Container } from "typedi";
|
||||||
import ExpressServer from "@Common/system/ExpressServer";
|
|
||||||
import routes from "@App/index";
|
|
||||||
import cors from "cors";
|
|
||||||
import bodyParser from "body-parser";
|
|
||||||
import errorHandler from "@App/middlewares/ErrorHandler";
|
|
||||||
import { BackendVariables } from "@Common/config/variables/Variables";
|
import { BackendVariables } from "@Common/config/variables/Variables";
|
||||||
import multer from "multer";
|
|
||||||
import CronService from "@Services/common/CronService/CronService";
|
import CronService from "@Services/common/CronService/CronService";
|
||||||
|
|
||||||
const storage = multer.memoryStorage();
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const variables = await Container.get(BackendVariables).validate();
|
const variables = await Container.get(BackendVariables).validate();
|
||||||
@ -19,24 +11,6 @@ const storage = multer.memoryStorage();
|
|||||||
if(variables.ENV === "stg"){
|
if(variables.ENV === "stg"){
|
||||||
Container.get(CronService).sendMails();
|
Container.get(CronService).sendMails();
|
||||||
}
|
}
|
||||||
const port = variables.APP_PORT;
|
|
||||||
const rootUrl = variables.APP_ROOT_URL;
|
|
||||||
const label = variables.APP_LABEL ?? "Unknown Service";
|
|
||||||
|
|
||||||
Container.get(ExpressServer).init({
|
|
||||||
label,
|
|
||||||
port: parseInt(port),
|
|
||||||
rootUrl,
|
|
||||||
middlwares: [
|
|
||||||
cors({ origin: "*" }),
|
|
||||||
multer({ storage: storage }).single("file"),
|
|
||||||
bodyParser.urlencoded({ extended: true }),
|
|
||||||
bodyParser.json(),
|
|
||||||
],
|
|
||||||
errorHandler,
|
|
||||||
});
|
|
||||||
|
|
||||||
routes.start();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user