-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (30 loc) · 984 Bytes
/
index.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
"use strict";
const express = require("express");
const app = express();
require("dotenv").config();
const PORT = process.env?.PORT || 8000;
require("express-async-errors");
const { dbConnection } = require("./src/configs/dbConnection");
dbConnection();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(require("./src/middlewares/logger"));
app.use(require("./src/middlewares/authentication"));
app.use(require("./src/middlewares/queryHandler"));
app.use("/", require("./src/routes/"));
app.all("/", (req, res) => {
res.send({
error: false,
message: "Welcome to PIZZA API",
docs: {
swagger: "/documents/swagger",
redoc: "/documents/redoc",
json: "/documents/json",
},
user: req.user,
});
});
app.use("/uploads", express.static("./uploads"));
app.use(require("./src/middlewares/errorHandler"));
app.listen(PORT, () => console.log("http://127.0.0.1:" + PORT));
// require('./src/helpers/sync')()