example with serverless
Add an example demonstrating nextjs with serverless
The main goal is to get all the following pieces work together
serverlessserverless-offline to get it work for emulating locally - (development)express to handle all the routes and middlewaresaws-serverless-expressproduction)I guess https://github.com/danielcondemarin/serverless-nextjs-plugin covers what you're trying to do 馃
Give me 5 minutes. I'm sending a PR 馃槃
@timneutkens It's here 馃槈 #6685
I thought that it would be a good exercise to roll my own solution, so I have done so. My solution is a basic wrapper around the .next build folder that uses require.context that webpack makes possible to scan the .next build directory and discover all of the pages + setup express routes for them.
Now that I understand how it all works using webpack and express as ways to shortcut the solution I will be re-writing it using pure node + serverless-http. If it all works out without any major hitches I will re-upload the code as an example codebase so that people have the option of a lightweight rapper around nextjs's serverless option without having to become dependent on yet another plugin that might loose steam. That being said, holly crap there is allot of activity there currently (good sign!)
Either that or I will just replace require.context with pure node require() and that way there's no need for a build layer like webpack. I'll sleep on it and see what feels right
Closing this as we recommend using next dev in development. Deployment is easiest when using ZEIT Now as it automatically figures out static/dynamic (lambdas for dynamic, static on the CDN). https://nextjs.org/docs/deployment
Most helpful comment
Give me 5 minutes. I'm sending a PR 馃槃