Are there any downsides or limitations of using Next.js api routes instead of custom server? #17679
Replies
|
In case you decide to use a custom server, you'll implement your own route patterns.
More info: https://nextjs.org/docs/advanced-features/custom-server |
|
Serverless functions scale better, are faster, and cost less. The only limitation afaik is that you can't have live connections (like websockets), because that would require the serverless function to stay alive. |
|
Note: Really sorry if it's a silly question (hehe) I am trying to learn nextjs |
|
I'd be keen to know this. Is it suitable for a social media-like application using GraphQL? Will need posts, comments, upvotes, real time notifications etc. I know Lambdas don't maintain the sockets after cool down, but it seems like such an efficient way to build and deploy. What's the alternative? Spin up a separate AppSync / Apollo server to handle subscriptions? |
|
Hi @mimoid-prog, how did your transition to api routes go? Would you mind to share your experience? Especially with db connections |
Insert Link
Translated from {{ originalLanguageInEnglish }}
Beta Was this translation helpful? Give Feedback
Beta 이 번역이 도움이 되셨나요? 피드백 제공
Beta Esta tradução foi útil? Dê sua opinião
Beta ¿Fue útil esta traducción? Envía tus comentarios


I have a huge backend application using Express, with many routes, middlewares, databases etc. Is it possible to recreate all of these features and others using Next.js API routes and is it worth to do so? What are the downsides of using API routes?