-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (27 loc) · 1018 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
38
39
// Imports
const dotenv = require("dotenv");
const express = require("express");
const morgan = require("morgan");
const questionRouter = require("./routes/questionRoutes");
const answerRouter = require("./routes/answerRoutes");
const HTMLQuestionRouter = require("./routes/htmlquestionRoutes");
const HTMLAnswerRouter = require("./routes/htmlanswerRoutes");
const userRouter = require("./routes/userRoutes");
const settingsRouter = require("./routes/settingsRoutes");
const errorController = require("./controllers/errorController");
// Configuring dotenv
dotenv.config({
path: "./config.env",
});
const app = express();
app.use(morgan("dev"));
app.use(express.json());
// Routes
app.use("/api/v1/users", userRouter);
app.use("/api/v1/settings", settingsRouter);
app.use("/api/v1/questions", questionRouter);
app.use("/api/v1/answers", answerRouter);
app.use("/api/v1/htmlquestions", HTMLQuestionRouter);
app.use("/api/v1/htmlanswers", HTMLAnswerRouter);
app.use(errorController);
module.exports = app;