red-coder-bh/src/main.ts

21 lines
468 B
TypeScript
Raw Normal View History

2022-04-14 20:55:52 +03:00
import express from 'express';
2022-04-18 20:30:47 +03:00
import cookieSession from 'cookie-session';
2022-04-14 20:55:52 +03:00
2022-04-18 20:30:47 +03:00
import './config';
2022-04-14 20:55:52 +03:00
import { errorHandle } from './utils/error-handling';
2022-04-18 20:30:47 +03:00
import { router } from './routes';
2022-04-14 20:55:52 +03:00
const app = express();
2022-04-16 23:10:31 +03:00
const port = process.env.RED_CODER_BH_PORT;
2022-04-14 20:55:52 +03:00
2022-04-18 20:30:47 +03:00
app.use(express.json());
app.use(cookieSession({ secret: process.env.COOKIE_SESSION }));
2022-04-14 20:55:52 +03:00
2022-04-18 20:30:47 +03:00
app.use(router);
2022-04-14 20:55:52 +03:00
app.use(errorHandle);
app.listen(port, () => {
console.log(`listen on http://localhost:${port}`);
});