26 lines
748 B
TypeScript
26 lines
748 B
TypeScript
import "reflect-metadata";
|
|
import * as dotenvSafe from "dotenv-safe";
|
|
import { createExpressServer } from "routing-controllers";
|
|
import consola from "consola";
|
|
import loaders from "./loaders/index";
|
|
import authchecker from "./authchecker";
|
|
import { ErrorHandler } from './middlewares/ErrorHandler';
|
|
//
|
|
dotenvSafe.config();
|
|
const PORT = process.env.APP_PORT || 4010;
|
|
|
|
const app = createExpressServer({
|
|
authorizationChecker: authchecker,
|
|
middlewares: [ErrorHandler],
|
|
development: false,
|
|
controllers: [`${__dirname}/controllers/*.ts`],
|
|
});
|
|
|
|
(async () => {
|
|
await loaders(app);
|
|
app.listen(PORT, () => {
|
|
consola.success(
|
|
`⚡️[server]: Server is running at http://localhost:${PORT}`
|
|
);
|
|
});
|
|
})(); |