elifetchmodes6

1.9.5 • Public • Published

To install local module into client folder

  • sudo npm link get link from path
  • cd client
  • sudo npm i (path from npm link

To use

import * as consume from "elifetchmodes6";

Accepts POST, GET, PUT, DELETE

GET

const object = {
  method: "GET",
  url: "https://jsonplaceholder.typicode.com/posts/1"
};
consume
  .fetch(object)
  .then(res => {
    console.log(res.data);
  })
  .catch(err => {
    console.log(err);
  });

Or POST

const value = { name: "Bob", job: "Software Dev" };
const object = {
  method: "POST",
  url: "https://jsonplaceholder.typicode.com/posts",
  data: { ...value }
};
consume
  .fetch(object)
  .then(res => {
    console.log(res.data);
  })
  .catch(err => {
    console.log(err);
  });

To Demo

npm run demo

Readme

Keywords

none

Package Sidebar

Install

npm i elifetchmodes6

Weekly Downloads

88

Version

1.9.5

License

ISC

Unpacked Size

567 kB

Total Files

29

Last publish

Collaborators

  • elihood