🚚 basic move to config.ts

ref #18
This commit is contained in:
2020-12-06 10:29:56 +01:00
parent 5c259484ee
commit 99d8a0360f
6 changed files with 23 additions and 15 deletions

View File

@@ -1,18 +1,15 @@
import consola from "consola";
import * as dotenvSafe from "dotenv-safe";
import "reflect-metadata";
import { createExpressServer } from "routing-controllers";
import authchecker from "./authchecker";
import { config } from './config';
import loaders from "./loaders/index";
import { ErrorHandler } from './middlewares/ErrorHandler';
dotenvSafe.config();
const PORT = process.env.APP_PORT || 4010;
const app = createExpressServer({
authorizationChecker: authchecker,
middlewares: [ErrorHandler],
development: process.env.NODE_ENV === "production",
development: config.development,
cors: true,
routePrefix: "/api",
controllers: [__dirname + "/controllers/*.ts"],
@@ -20,9 +17,9 @@ const app = createExpressServer({
async function main() {
await loaders(app);
app.listen(PORT, () => {
app.listen(config.internal_port, () => {
consola.success(
`⚡️[server]: Server is running at http://localhost:${PORT}`
`⚡️[server]: Server is running at http://localhost:${config.internal_port}`
);
});
}