33 lines
612 B
JavaScript
33 lines
612 B
JavaScript
import { dbInit } from './libs/database.js'
|
|
import dotenv from 'dotenv'
|
|
import express from 'express'
|
|
import njk from 'nunjucks'
|
|
import ROUTES from './routes/routes.js'
|
|
|
|
dotenv.config()
|
|
|
|
const APP = express()
|
|
const PORT = process.env.PORT ?? 12345
|
|
|
|
dbInit()
|
|
|
|
APP.use(express.urlencoded({ extended: true }))
|
|
APP.use('/static', express.static('static'))
|
|
|
|
APP.use('/', ROUTES)
|
|
|
|
njk.configure(
|
|
'views',
|
|
{
|
|
autoescape: true,
|
|
lstripBlocks: true,
|
|
trimBlocks: true,
|
|
express: APP,
|
|
}
|
|
)
|
|
|
|
APP.listen(
|
|
PORT,
|
|
() => console.log('Server started at http://localhost:' + PORT)
|
|
)
|