Abstract SSR & API Routes from Node.js #11326
davidbarratt
started this conversation in
Ideas
Replies: 1 comment
-
https://github.com/stealify/stealify/issues/63 i have also covered that topic that is the way to go!! The Concept of Platform and Environment Agnostic ECMAScript / ES / Javascript
we introduce 1 extra folders for thats environment
So we end up in 2 folders
the code in modules should depend on one or more environment dependencies. via a uniq interface |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Feature request
Using
next
for server-side rendering or API routes must be done in a Node.js runtime. This is because thenext
package is tightly bound to Node.js preventing using other runtimes like Deno, Electron or even the browser (which now has things like native filesystem support).It would be helpful if the core functionalities of
next
were abstracted from Node.js. This would be similar to the way a database abstraction layer would work. Effectivelynext
would have "adapters" (or something like that) for different runtimes. The default adapter (and the only one in core) would be a Node.js adapter, but other adapters could be created in userland.The
next
app would receive its necessary dependencies from the adapter. For instance it might get the parsed URL and a list of routes with regexes and callback functions to call to get the component for that route. The adapter might also provide a callback to determine the proper_app.js
and the like.Having a clear and documented interface for what an adapter should look like (and obviously a Node.js example) would be really helpful as well. :)
Describe alternatives you've considered
Beta Was this translation helpful? Give feedback.
All reactions