-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (24 loc) · 1.09 KB
/
app.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
require("dotenv").config(); // ℹ️ Gets access to environment variables/settings
require("./db"); // ℹ️ Connects to the database
const express = require("express"); // Handles http requests (express is node js framework)
const app = express();
const hbs = require("hbs"); // Handles the handlebars
const initHelpers = require("./utils/helpers");
require("./config")(app); // ℹ️ This function is getting exported from the config folder. It runs most pieces of middleware
require("./config/session.config")(app);
// default value for title local
const projectName = "NoGame";
app.locals.appTitle = `${projectName}`;
hbs.registerPartials(__dirname + "/views/partials");
initHelpers();
//
// ROUTES
//
app.use("/", require("./routes/index.routes"));
app.use("/", require("./routes/planets.routes"));
app.use("/", require("./routes/buildings.routes"));
app.use("/", require("./routes/auth.routes"));
app.use("/", require("./routes/search.routes"));
// ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes
require("./error-handling")(app);
module.exports = app;