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