-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
47 lines (38 loc) · 1.06 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
40
41
42
43
44
45
46
const express = require('express')
const query = require('express/lib/middleware/query')
const func = require('./backend/main')
const server = express()
server.set('view engine', 'ejs')
const port = process.env.PORT || 3009
server.use(express.static('public'))
server.get('/', (req,res) => {
const page = req.query.page || 1
const wpg = "?"
func.render_home(res,page,wpg)
})
server.get('/view', (req,res) => {
const page = req.query.page || 1
const wpg = "?"
func.render_home(res,page,wpg)
})
server.get('/latest', (req,res) => {
const page = req.query.page || 1
const wpg = "latest/?"
func.render_home(res,page,wpg)
})
server.get('/search', (req,res) => {
const page = req.query.page || 1
const wpg = `search?q=${req.query.q}&`
func.render_home(res,page,wpg)
})
server.get('/view/:animeID', (req,res) => {
get_id = req.params.animeID
get_ep = req.query.ep || 1
func.render_vPage(res,get_id,get_ep)
})
server.use(function(req,res){
res.status(404).render('404')
})
server.listen(port, () => {
console.log(`http://localhost:${port}`)
} )