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 18:47:56 +01:00
|
|
|
|
2022-01-15 19:27:18 +01:00
|
|
|
import ROUTES from './routes/routes.js'
|
|
|
|
import { dbInit } from './libs/database.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 19:27:18 +01:00
|
|
|
APP.listen(
|
|
|
|
PORT,
|
|
|
|
() => console.log('Server started at http://localhost:' + PORT)
|
|
|
|
)
|