3 ms·
Here's also Github. It's resource-oriented instead of verb-oriented (like Telegraph), so we use Jor instead of Jo (both are provided by the same library). Jor[
by fmontesi 8y ago
Here's also Github. It's resource-oriented instead of verb-oriented (like Telegraph), so we use Jor instead of Jo (both are provided by the same library).
Jor["users/fmontesi/repos"].get().then( response => ... );
Notice that using ["users/fmontesi/repos"] is the "alternative" syntax. If the resource path is a valid method name in JavaScript, e.g., "/users", you can just write this:
Jor.users.get().then( response => ... );
I'm still wondering what's the best way of offering resource paths. Using a string is fine, but another option would be to have an extension of JavaScript, like JSX in react, but that would add a dependency (on Babel, for example).
So we could do something like:
Jor.users/fmontesi/repos.get().then( response => ... );
Another option could be to use an in-between method, for example:
Jor.users._.fmontesi._.repos.get().then( response => ... );
But this looks a bit clunky. So the design space is a bit larger here. Mumble mumble. :-)