search examples
This commit is contained in:
@@ -1,7 +1,26 @@
|
||||
const router = require('express').Router();
|
||||
|
||||
router.get('/landing-data', (request, response) => {
|
||||
response.send(require('./json/landing-data/success.json'))
|
||||
response.send(require('./json/landing-data/success.json'));
|
||||
});
|
||||
|
||||
router.post('/login', (req, response) => {
|
||||
const { username, password } = req.body;
|
||||
if (username === 'admin') {
|
||||
response.send(require('./json/user/sitter.success.json'));
|
||||
} else {
|
||||
response.send(require('./json/landing-data/success.json'));
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/search', (req, res) => {
|
||||
const { search } = req.body;
|
||||
|
||||
if (search === 'Morty') {
|
||||
return res.send(require('./json/seach/alive.success.json'));
|
||||
}
|
||||
|
||||
res.send(require('./json/seach/success.json'));
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
|
||||
24
server/routers/r-and-m/json/seach/alive.success.json
Normal file
24
server/routers/r-and-m/json/seach/alive.success.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": 14,
|
||||
"name": "Morty",
|
||||
"status": "alive",
|
||||
"species": "Alien",
|
||||
"type": "",
|
||||
"gender": "Male",
|
||||
"origin": {
|
||||
"name": "unknown",
|
||||
"url": ""
|
||||
},
|
||||
"location": {
|
||||
"name": "Citadel of Ricks",
|
||||
"url": "https://rickandmortyapi.com/api/location/3"
|
||||
},
|
||||
"image": "https://rickandmortyapi.com/api/character/avatar/14.jpeg",
|
||||
"episode": ["https://rickandmortyapi.com/api/episode/10"],
|
||||
"url": "https://rickandmortyapi.com/api/character/14",
|
||||
"created": "2017-11-04T20:51:31.373Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
24
server/routers/r-and-m/json/seach/success.json
Normal file
24
server/routers/r-and-m/json/seach/success.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": 14,
|
||||
"name": "Alien Morty",
|
||||
"status": "unknown",
|
||||
"species": "Alien",
|
||||
"type": "",
|
||||
"gender": "Male",
|
||||
"origin": {
|
||||
"name": "unknown",
|
||||
"url": ""
|
||||
},
|
||||
"location": {
|
||||
"name": "Citadel of Ricks",
|
||||
"url": "https://rickandmortyapi.com/api/location/3"
|
||||
},
|
||||
"image": "https://rickandmortyapi.com/api/character/avatar/14.jpeg",
|
||||
"episode": ["https://rickandmortyapi.com/api/episode/10"],
|
||||
"url": "https://rickandmortyapi.com/api/character/14",
|
||||
"created": "2017-11-04T20:51:31.373Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user