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 have an app in which some routes are only relevant on the server. When I do a GET or POST to these routes I want the request to perform a full HTTP request rather than attempt an XHR and 404.
This is currently possible by using a fully qualified URL which isorouter treats as a full page refresh but it requires knowledge that route x needs this special treatment.
Would propose that the route matching return false if there is no handler which matches the given pathname. For example.
isomorphic_routes.js
isorouter.use(middleware1);
isorouter.use(middleware2);
isorouter.get("/fish", function () {});
server_routes.js
router.get("/face", function () {});
If you hit this app with GET /fish it will run middleware 1 and 2 and also the fish handler and do so on both client and server side.
If you hit this app with GET /face' with HTTP it will handle the request but fail from a loaded client app. If you tap a link to/face` it will run through the middleware and fail silently. Sad face.
Would be nice if isorouter could detect that there is no handler for a pathname matching the link <a href="/face"> and perform a HTTP request.
In the current code this would involve returning false to router.go() called from lib/dom_event_listener.js so the event isn't cancelled. This could be done by modifying the go method in browser.js to only return true if there was one or more route match (ignore middleware).
The text was updated successfully, but these errors were encountered:
Use case:
I have an app in which some routes are only relevant on the server. When I do a GET or POST to these routes I want the request to perform a full HTTP request rather than attempt an XHR and 404.
This is currently possible by using a fully qualified URL which isorouter treats as a full page refresh but it requires knowledge that route x needs this special treatment.
Would propose that the route matching return
false
if there is no handler which matches the given pathname. For example.isomorphic_routes.js
server_routes.js
If you hit this app with
GET /fish
it will run middleware 1 and 2 and also the fish handler and do so on both client and server side.If you hit this app with
GET /face' with HTTP it will handle the request but fail from a loaded client app. If you tap a link to
/face` it will run through the middleware and fail silently. Sad face.Would be nice if isorouter could detect that there is no handler for a pathname matching the link
<a href="/face">
and perform a HTTP request.In the current code this would involve returning
false
torouter.go()
called fromlib/dom_event_listener.js
so the event isn't cancelled. This could be done by modifying thego
method inbrowser.js
to only return true if there was one or more route match (ignore middleware).The text was updated successfully, but these errors were encountered: