mockserver
mockserver copied to clipboard
Middleware to add a root path to the app routes
Hi guys,
I just wanted to check if I can add a root path to all the express routes ?
In express, the similar can be achieved using the below code
app.use('/api/v1', allRoutes);
So basically, any route like /product/:id
would become /api/v1/product/:id
.
I tried doing something similar using middlewares but unfortunately it didnt work
{
id: 'root-path',
url: '/api/v1',
method: ["GET", "POST", "PUT", "PATCH"],
variants: [
{
id: 'enabled',
response: (req, res, next) => next(),
},
],
},