Skip to content

litek/modelagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modelagent

SuperAgent with promise and url pattern support.

Promises

Returns an ES6 promise if no callback is specified.

request.get('/api/pets').end().then(function(res) {
  // do something with res
}).catch(function(err) {
  // caught an error
});

URL pattern

Creates a reusable url pattern based agent. Unspecified keys will be removed from the url.

var pets = request.api('/pets/:id');

// GET /pets
pets.get().end()

// GET /pets/1
pets.get({id: 1}).end()

// POST /pets
pets.post({name: 'Old Yeller'}).end();

// PATCH /pets/1
// id is not included in body
pets.patch({id: 1, name: 'New Yeller'}).end();

About

Superagent with promise and url pattern support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published