next-routes icon indicating copy to clipboard operation
next-routes copied to clipboard

Define initial routes based on user agent

Open ssolanki opened this issue 4 years ago • 0 comments

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)

ssolanki avatar Sep 17 '19 15:09 ssolanki