1.0.6 • Published 3 years ago

fetchwithamit v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

fetchwithamit

Features

  • Supports the Promise API
  • Make http requests from node.js
  • Transform request and response data

Installing

npm i fetchwithamit

Basic Usage

import

import fetchwithamit from 'fetchwithamit'
or
const fetchwithamit = require('fetchwithamit')

Performing a GET request

fetchwithamit.get('https://pokeapi.co/api/v2/pokemon/pikachu')
.then(response => console.log(response.data))
.catch(err => console.log(err))

Performing a POST request

let postData = {
    name:"XYZ",
    salary:100000,
    age:24
}

fetchwithamit
.post('https://dummy.restapiexample.com/api/v1/create', postData)
.then(response => console.log(response.data))
.catch(err => console.log(err))

request by passing object

fetchwithamit.fetch({
    method: 'get',
    url: ''https://pokeapi.co/api/v2/pokemon/pikachu''
})
.then(response => console.log(response.data))
.catch(err => console.log(err))

Testing dummy

fetchwithamit.dummy()
.then(response => console.log(response))
.catch(err => console.log(err))

Credits

This plugin uses axios library internally for fetching data

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago