-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
42 lines (36 loc) · 1.22 KB
/
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
40
41
42
const express = require("express");
const cors = require("cors");
require("dotenv").config();
//require routes
const authRoutes = require("./routes/auth");
const userRoutes = require("./routes/user");
const medicinesRoutes = require("./routes/medicines");
const suppliersRoutes = require("./routes/suppliers");
const purchaseRoutes = require("./routes/purchases");
const salesRoutes = require("./routes/sales");
const reportRoutes = require("./routes/report");
const homeRoutes = require("./routes/home");
const app = express();
app.use(cors());
app.use(express.json());
// middleware to set the Permissions-Policy header
app.use((req, res, next) => {
res.setHeader(
"Permissions-Policy",
"private-state-token-redemption=(), private-state-token-issuance=(), browsing-topics=()"
);
next();
});
//routes
app.use("/api/auth", authRoutes);
app.use("/api/users", userRoutes);
app.use("/api/medicines", medicinesRoutes);
app.use("/api/suppliers", suppliersRoutes);
app.use("/api/purchases", purchaseRoutes);
app.use("/api/sales", salesRoutes);
app.use("/api/home", homeRoutes);
app.use("/api/report", reportRoutes);
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});