Skip to content

rinne/node-tr-jsonclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

In a Nutshell

Small promise-based utility function to http/https GET a JSON blob from URI and return it as a parsed object.

Reference

const JsonClient = require('tr-jsonclient');

var client = new JsonClient();

return (client.c('https://www.foo.bar/post-endpoint/somewhere', { foo: 'bar', something: 'or another', a: [1,2,3] })
        .then(function(ret) {
            console.log('JSON POST response:', ret);
        })
        .then(function() {
            return client.c('https://www.foo.bar/some.json');
        .then(function(ret) {
            console.log('JSON GET response:', ret);
        })
        .catch(function(e) {
            console.log('Something terrible happened');
            throw e;
        }));


Author

Timo J. Rinne tri@iki.fi

License

GPL-2.0

About

Simple promise-based JSON API client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published