qwik-account-manager/index.js

33 lines
612 B
JavaScript
Raw Normal View History

2022-01-15 20:40:41 +01:00
import { dbInit } from './libs/database.js'
2022-01-15 18:47:56 +01:00
import dotenv from 'dotenv'
2022-01-15 19:27:18 +01:00
import express from 'express'
2022-01-15 20:40:41 +01:00
import njk from 'nunjucks'
2022-01-15 19:27:18 +01:00
import ROUTES from './routes/routes.js'
2022-01-15 18:47:56 +01:00
dotenv.config()
2022-01-15 19:27:18 +01:00
const APP = express()
const PORT = process.env.PORT ?? 12345
2022-01-15 18:47:56 +01:00
dbInit()
2022-01-15 19:27:18 +01:00
APP.use(express.urlencoded({ extended: true }))
APP.use('/static', express.static('static'))
2022-01-15 18:47:56 +01:00
2022-01-15 19:27:18 +01:00
APP.use('/', ROUTES)
2022-01-15 18:47:56 +01:00
2022-01-15 20:40:41 +01:00
njk.configure(
'views',
{
autoescape: true,
lstripBlocks: true,
trimBlocks: true,
express: APP,
}
)
2022-01-15 19:27:18 +01:00
APP.listen(
PORT,
() => console.log('Server started at http://localhost:' + PORT)
)