Skip to content

jsonServer.rewriter not work in module solution #518

Open
@qiluo

Description

@qiluo

My main code is very simple as below,

/// Set default middlewares (logger, static, cors and no-cache)
server.use(middlewares);

// To handle POST, PUT and PATCH you need to use a body-parser
// You can use the one used by JSON Server
server.use(jsonServer.bodyParser);

// Use default router
// server.use(jsonServer.rewriter({
//     '/api/v1/': '/'
// }));
server.use('/api/v1', router);
server.listen(3000, () => {
    console.log('JSON Server is running')
});

neither rewriter nor server.use('/api/v1', router) worked, the access url only happened on / not /api/v1/...

any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions