1.0.6 • Published 3 years ago
fetchwithamit v1.0.6
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