ddstats-server/index.js

27 lines
678 B
JavaScript

import express from 'express'
import dotenv from 'dotenv'
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 ]")
// Read the .env file
dotenv.config()
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"
}
)
)
await databaseInit()
await sqlite2mongo()
Server.listen(process.env.PORT, () => log(`Server started and listening on port ${process.env.PORT}.`))