gvergnaud / nextjs-dynamic-routes

[Deprecated] Super simple way to create dynamic routes with Next.js
MIT License
140 stars 7 forks source link

Question: Serverless NextJS ? #9

Closed revskill10 closed 5 years ago

revskill10 commented 5 years ago

I'm sorry if this isn't related to an issue. It's one question about serverless environment. How to use this library on serverless with interface:

function handler = async (req, res) => {
...
}

?

gvergnaud commented 5 years ago

You can probably use the same approach as what you can see here https://github.com/gvergnaud/nextjs-dynamic-routes/blob/master/example/express/server.js

Your handler would be the function returned by Router.getRequestHandler(app).

lishine commented 5 years ago

I intend to use next.js with now v2. How to do it ? @gvergnaud I suppose that need to use the router as is but without custom server. Write the routes in now.json ? @revskill10 As I understand from your question, you deploy custom server with next/node ? Is it working that way? I thought custom server not working with now v2...