-
Notifications
You must be signed in to change notification settings - Fork 91
/
index.js
36 lines (34 loc) · 982 Bytes
/
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
require('dotenv').config();
const express = require("express");
const app = express();
const PORT = process.env.PORT || 3000;
const manga = require("./routers/manga");
const chapter = require("./routers/chapter");
const cors = require("cors");
const helmet = require("helmet");
app.use(cors());
app.use(helmet());
app.use("/api", manga);
app.use(express.static("./public"));
app.use("/api/chapter", chapter);
app.use("/api", (req, res) => {
res.send({
status: true,
message:
"For more info, check out https://github.com/febryardiansyah/manga-api",
find_me_on: {
facebook: "https://www.facebook.com/febry.ardiansyah.792/",
instagram: "https://instagram.com/febry_ardiansyah24",
github: "https://github.com/febryardiansyah/manga-api",
},
});
});
app.use("*", (req, res) => {
res.status(404).json({
success: false,
message: "api path not found",
});
});
app.listen(PORT, () => {
console.log("Listening on PORT:" + PORT);
});