-
Notifications
You must be signed in to change notification settings - Fork 51
/
app.js
38 lines (33 loc) · 992 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
33
34
35
36
37
38
const express = require('express')
const app = express()
const port = process.env.PORT || 3000
const router = require('./routes/index')
const cors = require('cors')
const bodyParser = require('body-parser')
const fileUpload = require('express-fileupload')
app.use(cors())
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended:true}))
app.use(fileUpload({createParentPath:true}))
app.use('/api',router)
app.use('/',(req,res)=>{
res.send({
message : 'Welcome To Unofficial Otakudesu Rest Api',
createdBy : 'KaedeNoKi Team ♥️'
})
})
app.use('/api',(req,res) =>{
res.send({
message:'check our github for more info',
github :'https://github.com/Kaede-No-Ki/otakudesu-rest-api'
})
})
app.use('*',(req,res) =>{
res.json({
'status':'not found path',
message: 'read the docs here https://github.com/Kaede-No-Ki/otakudesu-rest-api'
})
})
app.listen(port, () => {
console.log('listening on port', port)
})