-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
29 lines (24 loc) · 923 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
const express = require("express");
const cors = require('cors');
const path = require('path');
require("./models");
const app = express();
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use((req, res, next) => {
console.log(new Date(), req.url);
next();
});
app.use(express.static(path.join(__dirname, "../frontend/dist")));
app.use("/api/trucks", require("./controllers/truck"));
app.use("/api/truck_cats", require("./controllers/truck_cat"));
app.use("/api/costs", require("./controllers/cost"));
app.use("/api/drivers", require("./controllers/driver"));
app.use("/api/customers", require("./controllers/customer"));
app.use("/api/orders", require("./controllers/order"));
app.use("/api/users", require("./controllers/user"));
app.use("/api/report", require("./controllers/report"));
app.listen(3000, () => {
console.log("Service is running on port 3000");
});