-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
22 lines (17 loc) · 707 Bytes
/
app.js
File metadata and controls
22 lines (17 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const express = require("express");
const AppError = require("./utils/appError");
const globalErrorHandler = require("./Controller/errorController");
const userRoutes = require(`${__dirname}/routes/userRoutes`);
const partyRoutes = require(`${__dirname}/routes/partyRoutes`);
const workRoutes = require(`${__dirname}/routes/workRoutes`);
const app = express();
app.use(express.json({ limit: "10kb" }));
app.use("/v1/users/", userRoutes);
app.use("/v1/party/", partyRoutes);
app.use("/v1/work/", workRoutes);
app.all("*", (req, res, next) => {
next(new AppError(`Can't find ${req.originalUrl} on this Server`, 404));
});
// Error Handling Middleware
app.use(globalErrorHandler);
module.exports = app;