Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including howhap-fetch with all npm packages installed. Try it out:

var howhapFetch = require("howhap-fetch")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

howhap-fetch v1.7.4

Promise based AJAX library that supports howhap errors.

howhap fetch

npm install --save howhap-fetch

Promise based AJAX library that supports howhap errors.

Usage

import fetch from 'howhap-fetch';

fetch.get('/api/v1/products')
.then(function(products) {
    console.log(products);
})
.catch(function(err) {
    console.log(err.display());
});

Methods

  • All methods are promise based.
  • .then(...) will receive the data that was returned from the server as JSON.
  • .catch(...) will receive a howhap list of errors returned from the server and supports all howhap list methods.

fetch.get(url, data)

Make a GET request to the specified url.

  • url: the url to make the request
  • data: object of key/value pairs to be encoded into the url as query parameters

fetch.post(url, data)

Make a POST request to the specified url.

  • url: the url to make the request
  • data: object of key/value pairs to be encoded into the body

fetch.put(url, data)

Make a PUT request to the specified url.

  • url: the url to make the request
  • data: object of key/value pairs to be encoded into the body

fetch.delete(url, data)

Make a DELETE request to the specified url.

  • url: the url to make the request
  • data: object of key/value pairs to be encoded into the body
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free