Open imageslr opened 5 years ago
Hello, I wonder to know how can I return different data based on query parameters. I want it to look like this:
server.get('/books?isbn=:isbn', (req, res) => { // ... mock some data res.jsonp(req.query) })
But it seems not work. If I use a rewriter:
const rewriter = jsonServer.rewriter({ "/books?isbn=:isbn": "/books/1" }) server.use(rewriter)
It works. But it can only return same data. So could you please tell me how to implement this? Thank you sou much!
I have the same issue, i get a 404 with
server.get('/api/thing/another_place?emails=:emailList', (req, res) => { res.jsonp(mock data from another module) });
Hello, I wonder to know how can I return different data based on query parameters. I want it to look like this:
But it seems not work. If I use a rewriter:
It works. But it can only return same data. So could you please tell me how to implement this? Thank you sou much!