-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyans_translator_back.js
49 lines (37 loc) · 1.05 KB
/
yans_translator_back.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Module dependencies.
*/
const express = require("express");
const dotenv = require("dotenv");
const passport = require("passport");
const mongoHandler = require("./config/mongoHandler");
// Load environment variables from .env file to process.env, where API keys and passwords are configured.
dotenv.config({ path: ".env" });
// connect to mongo
mongoHandler.connectDB();
// register mongoose models
require("./models");
mongoHandler.connectDBS();
// create passport
require("./config/passport")(passport);
// create express server.
const app = express();
// Initialise routes by arguments
const router = express.Router();
require("./config/routes")(router);
// express setup
require("./config/express")(app, passport, router);
require("./config/logger");
/**
* Start Express server.
*/
app.listen(app.get("port"), () => {
console.log(
`App is running at \x1b[33mhttp://localhost:${app.get(
"port"
)}\x1b[0m in ${app.get("env")} mode`
);
console.log(" Press CTRL-C to stop\n");
});
setTimeout(() => {}, 4000);
module.exports = app;