-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
28 lines (22 loc) · 794 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
const express = require("express");
const app = express();
const cors = require("cors");
const allShopsRouter = require("./routes/allShops/allShops");
const burgersRouter = require("./routes/burgers/burgers");
const hotDogsRouter = require("./routes/hotDogs/hotDogs");
const pizzaRouter = require("./routes/pizzas/pizzas");
const ordersRouter = require("./routes/orders/orders");
app.use(cors());
app.use(express.json());
app.use("/allShops", allShopsRouter);
app.use("/burgers", burgersRouter);
app.use("/pizzas", pizzaRouter);
app.use("/hotDogs", hotDogsRouter);
app.use("/orders", ordersRouter);
app.use((req, res) => {
res.status(404).json({ message: "Not found" });
});
app.use((err, req, res, next) => {
res.status(500).json({ message: err.message });
});
module.exports = app;