You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building an Express webserver including a simple backend and a NextJS frontend that can serve multiple different sites with many different URLs. The idea is that the service scales automatically in a basic Google App Engine I've set up. Basically one server instance can serve as a frontend or backend for any site (around 5-10 sites in the beginning) depending on where there is a need and then when GAE decides there's too much load, it can automatically assign another server instance that can help in whatever needed for any of the sites.
I've made a decision to have all my data in a NoSQL cloud storage and fetch the data dynamically in getServerSideProps. I want to control all paths dynamically in my database so I've put app.render() in the server.get('*' ... wildcard route with using handle() function only when necessary. I've concluded that I need to use the handle() in three scenarios:
If the path is an internal NextJS path (starting /_next/) or
the path refers to a file that is present in the /public/ folder or
the path refers to a hardcoded site template (there is a .tsx or .jsx corresponding the path in pages folder).
Are there any other situations where I should to use the handle() function?
Also please share your thoughts if you think I am overcomplicating this or if there is something else that comes to mind! Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building an Express webserver including a simple backend and a NextJS frontend that can serve multiple different sites with many different URLs. The idea is that the service scales automatically in a basic Google App Engine I've set up. Basically one server instance can serve as a frontend or backend for any site (around 5-10 sites in the beginning) depending on where there is a need and then when GAE decides there's too much load, it can automatically assign another server instance that can help in whatever needed for any of the sites.
I've made a decision to have all my data in a NoSQL cloud storage and fetch the data dynamically in getServerSideProps. I want to control all paths dynamically in my database so I've put
app.render()
in theserver.get('*' ...
wildcard route with usinghandle()
function only when necessary. I've concluded that I need to use thehandle()
in three scenarios:/_next/
) or/public/
folder orpages
folder).Are there any other situations where I should to use the
handle()
function?Also please share your thoughts if you think I am overcomplicating this or if there is something else that comes to mind! Thanks!
server.ts:
pages/index.tsx:
Beta Was this translation helpful? Give feedback.
All reactions