Reputation: 4500
Next.js is about server side rendering. Therefore have the render server (rendering the HTML) along with the API server seems to be a natural choice— it probably makes the rendering time much lower than having a separate API server (service)
That’s what I am thinking of theoretically.
But I would like to know if next.js applications are typically deployed in this way (a node server host both the api service and the next.js app).
Or does it make sense to have one service host the next.js app and another service host the rest api endpoints. e.g
Upvotes: 3
Views: 754
Reputation: 3908
Lambda@Edge functions can only operate for a maximum of 5 seconds for viewer request functions and 30 seconds for origin request functions, so it's probably not practical to have the entire Next.js app on Lambda@Edge.
You could have individual portions of the app's logic on Lambda@Edge, but you also need to think about total package size because there are restrictions there as well.
Upvotes: 1