Started switching to CommonJS

import to require
This commit is contained in:
2020-10-07 21:18:09 +02:00
parent 8437ea4682
commit 871919c838
7 changed files with 47 additions and 95 deletions

24
app.js Normal file
View File

@@ -0,0 +1,24 @@
const config = require("./config/index.js");
const { port, dbPass, cookiesSecret } = config;
const express = require("express");
const app = express();
const loaders = require("./loaders/index.js");
//
// Server init function
//
async function startServer() {
await loaders({
expressApp: app,
dbPass: dbPass,
secret: cookiesSecret,
});
app.listen(port, (err) => {
if (err) {
console.log("Server Startup Failed");
return;
}
console.log("Server is running");
});
}
startServer();