next-routes
next-routes copied to clipboard
Define initial routes based on user agent
I want to show a different page on the same route(/login
) for mobile and desktop based on the userAgent. In my pages folder, I have two different page components login
and loginMobile
.
This is my routes.js
file:
module.exports = routes()
// login page
.add("login")
// .add("loginMobile")
I am using express server and importing routes like this:
const routes = require("../routes")
const dev = process.env.NODE_ENV !== "production"
const app = next({ dev })
const handler = routes.getRequestHandler(app)