fetch-api-data

1.0.6Β β€’Β PublicΒ β€’Β Published

fetch-api-data

npm bundle size NPM npm

πŸš€ Promise based function for calling API easily in Node Js or any Javascript framework!

Installing

Using npm:

$ npm install fetch-api-data

Example

import fetchAPIData from "fetch-api-data"

or

const fetchAPIData = require('fetch-api-data')

For GET Request

fetchAPIData("https://jsonplaceholder.typicode.com/todos").then((res) => {
    console.log(res);
}).catch((err) => {
    console.log(err);
});

For POST Request

const formData = {
    email: "test@test.com",
    password: "1234"
}
fetchAPIData("https://reqres.in/api/users", formData, "POST").then((json) => {
    console.log(json)
});

πŸš€And you are all set to use this package!

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i fetch-api-data

      Weekly Downloads

      8

      Version

      1.0.6

      License

      MIT

      Unpacked Size

      4.18 kB

      Total Files

      4

      Last publish

      Collaborators

      • hyderyash