ddstats-server/index.js

27 lines
678 B
JavaScript
Raw Normal View History

2021-09-25 12:11:27 +02:00
import express from 'express'
2021-09-25 17:47:05 +02:00
import dotenv from 'dotenv'
2021-09-29 20:29:06 +02:00
import sqlite2mongo from './libs/database/sqlite2mongo.js'
import databaseInit from './libs/database/init.js'
import initLog from './libs/utills/log.js'
const log = initLog("[ MAIN ]")
2021-09-25 17:47:05 +02:00
// Read the .env file
dotenv.config()
2021-09-25 12:11:27 +02:00
const Server = express()
Server.get('/', (req, res) =>
res.status(200)
.json(
{
status: "OK!",
message: "The API is up and running! The current version is: 0.0.1"
}
)
)
2021-09-29 20:29:06 +02:00
await databaseInit()
await sqlite2mongo()
2021-09-25 17:47:05 +02:00
2021-09-29 20:29:06 +02:00
Server.listen(process.env.PORT, () => log(`Server started and listening on port ${process.env.PORT}.`))