-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
37 lines (25 loc) · 930 Bytes
/
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
32
33
34
35
36
37
// Gets access to environment variables/settings
require("dotenv").config();
// Connects to the database
require("./db");
// Handles http requests (express is node js framework)
const express = require("express");
const app = express();
// This function is getting exported from the config folder. It the middleware
require("./config")(app);
// ROUTES
const indexRoutes = require("./routes/index.routes");
app.use("/", indexRoutes);
const booksRoutes = require("./routes/books.routes");
app.use("/", booksRoutes);
const authorsRoutes = require("./routes/authors.routes");
app.use("/", authorsRoutes);
const userRoutes = require("./routes/user.routes");
app.use("/", userRoutes);
const notesRoutes = require("./routes/notes.routes");
app.use("/", notesRoutes);
const authRoutes = require("./routes/auth.routes");
app.use("/auth", authRoutes);
// To handle errors
require("./error-handling")(app);
module.exports = app;