Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
tonic + npm: beautapi
node v4.9.1
version:
1.0.0
endpoint
share
tweet
const Beautapi = require("beautapi"); const Fetch = require("node-fetch"); const model = { Posts: { getAll: "/posts", get: "posts/:id", } }; const config = { endpointPrefix: "http://jsonplaceholder.typicode.com", fetchReference: Fetch, thenChain: [ Beautapi.helpers.parseJSON ] }; const Api = Beautapi.parse(model, config); Api.Posts.getAll() .then((response) => { console.log(response); }) .catch((err) => { console.err(err); })
Created from: https://tonicdev.com/npm/beautapi
Loading…
no comments
sign in
to comment