-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (27 loc) · 711 Bytes
/
index.js
File metadata and controls
38 lines (27 loc) · 711 Bytes
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 data = require('./dummy')
const api = express()
const HOST = 'localhost'
const PORT = 8888
api.get('/', (req,res) => {
res.send('<h1>Welcome to this API!</h1>')
})
api.get('/people', (req,res) => {
res.status(200).json(data)
})
api.post('/', (req,res) =>{
res.send('<h2> This is Done By Post Method!</h2>')
})
api.post('/register', (req,res) =>{
res.sendStatus(201)
})
api.put('/user/Deblina', (req,res) =>{
res.sendStatus(200)
})
api.patch('/user/deblina', (req,res) =>{
res.sendStatus(200)
})
api.delete('/user/deblina', (req,res) =>{
res.sendStatus(200)
})
api.listen(PORT, () => console.log(`API running at ${HOST}:${PORT}!`))