post stubs example
This commit is contained in:
@@ -7,10 +7,20 @@ router.get("/landing-data", (request, response) => {
|
||||
router.post("/login", (req, res) => {
|
||||
const { username, password } = req.body;
|
||||
if (username === "admin") {
|
||||
response.send(require("../json/landing-data/success.json"));
|
||||
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
stubs/json/seach/alive.success.json
Normal file
24
stubs/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
stubs/json/seach/success.json
Normal file
24
stubs/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"
|
||||
}
|
||||
]
|
||||
}
|
||||
6
stubs/json/user/sitter.success.json
Normal file
6
stubs/json/user/sitter.success.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"data": {
|
||||
"role": "sitter",
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user