Next.js Discord

Discord Forum

Serve standalone build with custom express server

Unanswered
Red Crossbill posted this in #help-forum
Open in Discord
Red CrossbillOP
Is there an example of how to use a next standalone build as an express middleware? The generated standalone server.js doesn't appear to use the same API as shown in the custom server documentation, and it's unclear how to make the middleware returned from next(..).getRequestHandler() use a standalone build.

2 Replies

Red CrossbillOP
A similar question has been asked here: https://github.com/vercel/next.js/discussions/34599
Red CrossbillOP
This could be a clue, but it'd be nice to have an official example: https://github.com/sladg/nextjs-lambda/blob/master/lib/server-handler/index.ts