basic loaders logic
This commit is contained in:
parent
d7b5563d0f
commit
ab0e925ab3
|
@ -4,6 +4,8 @@ import consola from 'consola';
|
|||
import * as jwt from 'jsonwebtoken';
|
||||
import { createConnection } from 'typeorm';
|
||||
import 'reflect-metadata';
|
||||
// const loaders = require('./loaders');
|
||||
import * as loaders from './loaders/index';
|
||||
|
||||
dotenvSafe.config();
|
||||
const app = express();
|
||||
|
@ -20,6 +22,7 @@ createConnection()
|
|||
consola.info(encoded);
|
||||
return res.send('Express + TypeScript Server');
|
||||
});
|
||||
// await loaders.init(app);
|
||||
app.listen(PORT, () => {
|
||||
consola.success(`⚡️[server]: Server is running at http://localhost:${PORT}`);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import express from 'express';
|
||||
import bodyParser from 'body-parser';
|
||||
import cors from 'cors';
|
||||
|
||||
export default async (app) => {
|
||||
app.get('/status', (req, res) => res.status(200).end());
|
||||
app.enable('trust proxy');
|
||||
|
||||
app.use(cors());
|
||||
// app.use(bodyParser.urlencoded({ extended: false }));
|
||||
|
||||
// more middlewares
|
||||
return app;
|
||||
};
|
Loading…
Reference in New Issue