rick-and-morty/stubs/api/index.js
2024-05-18 14:41:38 +03:00

27 lines
676 B
JavaScript

const router = require("express").Router();
router.get("/landing-data", (request, response) => {
response.send(require("../json/landing-data/success.json"));
});
router.post("/login", (req, res) => {
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;