async-labs / saas

Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
https://saas-app.async-await.com
MIT License
4.12k stars 685 forks source link

next.js v9 #31

Closed mmoyles87 closed 5 years ago

mmoyles87 commented 5 years ago

Are there any plans to upgrade to next.js v9? It has some cool new features like support for api routes. I was thinking this could get rid of the need to run 2 separate apps.

tima101 commented 5 years ago

@dubvfan87 Eventually, yes. No particular deadline.

Having app and api separated is not simply a matter of organization. When app and api are separated, page rendering in app does not block request processing in api. And vice versa, request processing in api does not block page rendering in app.

More on server blocking: https://async-await.com/article/how-to-scale-a-node-js-server-isolate-expensive-tasks-in-forked-process

Separation of app and api is done to create more scalable, production-ready app.

api routes that you mentioned in v9, from my quick glance, is opinionated feature that has opinion on where you should keep code for your app's routes. This new feature prescribes storing code for routes in pages/api, we store routes in lib/api. Not a big deal.

Link to the example with pages/api: https://github.com/zeit/next.js/tree/canary/examples/api-routes

tima101 commented 5 years ago

@dubvfan87 Next was recently upgraded to v9 in all web apps of saas repo.

Thanks to @delgermurun

mmoyles87 commented 5 years ago

Nice thanks for the heads up, and thanks to @delgermurun !