3 ms·
Another universal http option is : https://github.com/matthew-andrews/isomorphic-fetch https://github.com/matthew-andrews/isomorphic-fetch
by chadscira 10y ago
Another universal http option is : https://github.com/matthew-andrews/isomorphic-fetch https://github.com/matthew-andrews/isomorphic-fetch
- wwalser 10y agoThat's the opposite of what the question is asking for. They want to call fetch('/api/foo/bar') but on the client it does an HTTP call while on the server it recognizes that /api* is on the local system and therefore invoke that local route instead of doing an unnecessary http call. That's what I'm apparently failing to describe how to accomplish :).
- chadscira 10y agoOh i see, I actually accomplished that a while back by monkey patching superagent to use Hapi.js, and inject.