-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
42 lines (34 loc) · 1.31 KB
/
app.js
File metadata and controls
42 lines (34 loc) · 1.31 KB
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
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const helmet = require("helmet");
const app = express();
const PORT = Number(process.env.PORT) || 3000;
// Import Route
const userRoute = require("./routes/users");
const authRoute = require("./routes/auth");
const logRoute = require("./routes/logs");
const imageRoute = require("./routes/image");
const tenantRoute = require("./routes/tenants");
const merchantRoute = require("./routes/merchants");
const billingRoute = require("./routes/billings");
// Sync database, only uncomment when the app first running at your machine
// require("./helpers/sync");
// require("./helpers/seeder");
require("./helpers/cron");
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(helmet({ noCache: true }));
app.get("/", (req, res) => {
res.status(200).json({ err: false, msg: "Hello World" });
});
app.use("/api/v1/users", userRoute);
app.use("/api/v1/auth", authRoute);
app.use("/api/v1/logs", logRoute);
app.use("/api/v1/images", imageRoute);
app.use("/api/v1/tenants", tenantRoute);
app.use("/api/v1/merchants", merchantRoute);
app.use("/api/v1/billings", billingRoute);
app.listen(PORT, () => console.log(`Server running at http://localhost:${PORT}`));