red-coder-bh/src/main.ts

23 lines
498 B
TypeScript
Raw Normal View History

import express from 'express'
import cookieSession from 'cookie-session'
2022-04-14 20:55:52 +03:00
import './config'
import { errorHandle } from './utils/error-handling'
import { router } from './routes'
2022-05-29 21:52:40 +03:00
import cors from 'cors'
2022-04-14 20:55:52 +03:00
const app = express()
2022-04-14 20:55:52 +03:00
const port = process.env.RED_CODER_BH_PORT
2022-04-14 20:55:52 +03:00
app.use(express.json())
app.use(cookieSession({ secret: process.env.COOKIE_SESSION }))
2022-04-14 20:55:52 +03:00
2022-05-29 21:52:40 +03:00
app.use(cors('*'))
app.use(router)
2022-04-14 20:55:52 +03:00
app.use(errorHandle)
2022-04-14 20:55:52 +03:00
app.listen(port, () => {
console.log(`listen on http://localhost:${port}`)
})