3 ms·
Next.js routing limits have been for me the number one reason not to use it unfortunately.
by mijamo 4y ago
Next.js routing limits have been for me the number one reason not to use it unfortunately.
- leerob 4y agoCan you share more? With Middleware, you can run any arbitrary code to control routing: https://twitter.com/nextjs/status/1610663442825854980 https://twitter.com/nextjs/status/1610663442825854980. And with the `app` directory (beta), we're reimagining the Next.js routing system from the ground up: https://beta.nextjs.org/docs/routing/fundamentals https://beta.nextjs.org/docs/routing/fundamentals.
- techpression 4y agoNot the author but for me it’s insane that the router doesn’t do http routing on verbs but rather leave it to be repeatedly reimplemented in every single page (and the fact that you can’t do simple things like what’s been available in rails for over a decade with resources).
- robertlagrant 4y agoCan you give an example of routing based on verbs?
- techpression 4y agohttps://hexdocs.pm/phoenix/routing.html https://hexdocs.pm/phoenix/routing.html
- robertlagrant 4y agoUnderstood. This I think is a slightly different way of making a web application - NextJS is built on REST calls and client-side view changes. If I've understood correctly, your Phoenix example is more like traditional full page request response programming, where you can post a form and get back a whole new web page. Phoenix no doubt has magic to make the whole page not reload, but point being that I think a lot of NextJS's target users are developers who come from a REST + SPA background, and wouldn't think to send some data and get a changed view back. They'd send some data, maybe get a response, update their client side data store and their view would change automatically.
- techpression 4y agoIt works the same for JSON/REST in Phoenix though, you don’t have to concern yourself if it’s a GET or PATCH because the correct function has already been called from the router.
- robertlagrant 4y agoSure, understood. You can (and probably should) have a separate logic/controller layer from HTTP handling. You can do this with either though, I think? Just call a function in another file?