I want to mock a backend with a PUT API slightly different from the standard PUT /resources/:id.
I found a working ugly solution by intercepting my '/tasks', extracting the id from the JSON body and redirecting to '/tasks/:id'.
With:
server.put('/tasks/', (req, res, next) => {
res.redirect(302, 'http://localhost:3300/tasks/' + req.body.id);
});
But how to do it cleanly ? How to forward internally to the standard json-server processing for /tasks/:id without redirecting ?