forked from KatowProject/Kusonime-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (30 loc) · 805 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
37
38
39
40
41
/* Module */
const express = require('express');
const helmet = require('helmet');
const cors = require('cors');
/* ============ */
const PORT = process.env.PORT || 3000;
const general = require('./routers/general');
const link = require('./routers/anime');
const app = express();
/* app */
app.use(cors());
app.use(helmet());
app.use('/api', general);
app.use('/api/anime', link);
app.use(express.static('./public'));
/* Status */
app.use('/api', async (req, res) => {
res.send({
status: true,
message: 'Kusonime Scrapper',
repo: 'KatowProject'
});
});
app.use('*', async (req, res) => {
res.status(404).send({status: false, message: 'api not found'});
});
/* Listener */
app.listen(PORT, async () => {
console.log('Listening on PORT ' + PORT);
});