-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
39 lines (30 loc) · 1.05 KB
/
index.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
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const { homeRouter } = require("./app/routes/HomeRoutes");
const { detailRouter } = require("./app/routes/DetailRoutes");
const { episodeRouter } = require("./app/routes/EpisodeRoutes");
const { listRouter } = require("./app/routes/ListRoutes");
const { genreRouter } = require("./app/routes/GenreRoutes");
const { searchRouter } = require("./app/routes/SearchRoutes");
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors());
app.use(homeRouter);
app.use(detailRouter);
app.use(episodeRouter);
app.use(listRouter);
app.use(genreRouter);
app.use(searchRouter);
app.use("/ping", (req, res) => {
res.send({ status: true, message: "Hello im alive :D" });
});
app.use("*", (req, res) => {
res.send({ status: false, message: "URL not found" });
});
const PORT = process.env.PORT || 8090;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});