So i've been looking for a REST client that lets you specify path
parameters the same way that express handles routes with params in them.
I've been superagent for most of my http needs, but I want something that
goes one step further and automatically handles the encoding/replacing of
parameters.
Ideally I'd be able to do something like this with a request builder:
var path = "/users/:userId/things/:thingName/:optionalParam?";
var params = { userId: 1, thingName: "My Super Thing & Stuff"; }
var query = { search: "my search", type: 1 };
rest.get()
.base('http://api.example.com')
.path(path, params)
.query(query)
.accept('json')
.end(function() {}); // actually execute the request
This would execute a request to:
http://api.example.com/users/1/things/
My%20Super%20Thing%20%26%20Stuff?query=my%20search&type=1
What do people use for calling REST apis, besides manually constructing the
URL by concatenating/encoding things?
I'd expect something like this to exist already, so before I make it I
wanted to check with the community.
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/a1db38d0-6c20-4758-a072-b514f83b663c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.