I am trying to set up the routing with my next.js configuration. Whatever I tried so far did not produce the intended results. This is becoming confusing and frustrating for me, any help will be appreciated.
Here is what I want:
/ => /index.js/users/ => /user/index.js/users/[user-id] => /user/user.jsHere is what doesn't work:
module.exports = {
target: "serverless",
async rewrites() {
return {
afterFiles: [
{
source: "/users/",
destination: "/users/"
},
{
source: "/users/:path*",
destination: "/users/:path*"
},
{
source: "/:path*",
destination: "/:path*"
},
{
source: "/:else*",
destination: "/"
}
]
};
},
};