Code Monkey home page Code Monkey logo

wee-fetch's Introduction

wee-fetch

Isomorphic and minimalistic promise-based HTTP client for the browser, Node and React Native, focused to be used with JSON endpoints. Built on top of cross-fetch.

☑ Test browser.
☑ Test Node.
☐ Test React Native.
☐ Implement middlewares

How to use

This is something I built for my own use a while ago and now is public but lacking documentation. Down here you have a quick example of usage.

import Fetch from 'wee-fetch';

const api = new Fetch('https://domain.com/api/v1/');

// Using GET
api.get('users')
  .then((usersList) => {
    doSomethingWith(usersList);
  })
  .catch(() => {
    alert('Ops, the list of users could not be retreived!');
  });

// Using PUT
api.put('users/1', { name: 'John Doe' })
  .then((usersList) => {
    alert('User updated!');
  })
  .catch(() => {
    alert('Ops, the user could not be updated!');
  });

License

MIT License © 2021 Jose Robinson

wee-fetch's People

Contributors

jrobinsonc avatar

Stargazers

Roman avatar  avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.