-
Notifications
You must be signed in to change notification settings - Fork 120
/
app.js
32 lines (24 loc) · 770 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
30
31
32
const express = require("express");
const app = express();
const path = require("path");
const bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({ extended: true }));
const { randomSeries, ratingSeries, genreSeries } = require("./functions");
app.get("/", (req, res) => {
res.sendFile(__dirname + "/index.html");
});
app.get("/random", (req, res) => {
res.json(randomSeries());
});
app.get("/list", (req, res) => {
res.sendFile(__dirname + "/web-series/index.json");
});
app.get("/rating/:id1", (req, res) => {
res.json(ratingSeries(req.params.id1));
});
app.get("/genre/:genre", (req, res) => {
res.json(genreSeries(req.params.genre));
});
app.listen(process.env.PORT || 3000, () => {
console.log("Sever is up and running !!");
});