Open santosh-cuemath opened 1 year ago
You can use the next js rewrites in your next.config.json
for this.
// next.config.json
// Existing routes configured with next-routes
const routes = require("./your-next-routes")
// Map the routes to the below shape
// routes = [{ source: '/about', destination: '/' }]
module.exports = {
async rewrites() {
return [...routes]
}
}
In your server.js
file delete routes import and use app.getRequestHandler()
// server.js
const handle = app.getRequestHandler();
server.get("*", (req, res) => {
return handle(req, res);
});
Might have to delete the .next
folder before giving it a go.
Are there any easy migration step to migrate to inbuilt nextjs routing