Thanks for the links. Swagger looks interesting but it is definitely a bit overkill for what I'm looking for. I was thinking of something more generic that just closes the gap between superagent and manual uri building.
On Saturday, August 2, 2014 2:30:06 PM UTC-4, Levi Lewis wrote: > > The Swagger JS client can do it, but may take this a bit further than what > you are asking for. Requires your API to expose swagger spec compliant JSON > to describe the web services. > > Document API with this: > https://github.com/wordnik/swagger-spec/ > > Then point the js client to API > https://github.com/wordnik/swagger-js > > Bonus, after those two steps: > https://github.com/wordnik/swagger-ui > > In addition to js, generate other clients: > https://github.com/wordnik/swagger-codegen > > -- Levi > > On Aug 1, 2014, at 3:37 PM, Paul <[email protected] <javascript:>> wrote: > > 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] <javascript:>. > To post to this group, send email to [email protected] <javascript:> > . > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/a1db38d0-6c20-4758-a072-b514f83b663c%40googlegroups.com > > <https://groups.google.com/d/msgid/nodejs/a1db38d0-6c20-4758-a072-b514f83b663c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- 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/f85f0fc6-8cf6-4781-aac1-accb6819f704%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
