axios-lite

1.0.2 • Public • Published

react-server-request

react-server-request

Browser Support

Chrome Firefox Safari Opera Edge IE
Latest Latest Latest Latest Latest 11

Installing

Using npm:

$ npm i react-server-request
$ npm i axios-lite

Using bower:

$ bower i react-server-request

Using yarn:

$ yarn add react-server-request

use react-server-request simply:



// file name API.js
import {Request} from 'react-server-request'
import {Request} from 'axios-lite'

export default  new Request('here will be main path')

// this is like  ----->
// const API = new Request('https://jsonplaceholder.typicode.com')
 
// get request for loading data
// get request for loading data
import {API} from './api'

API.get('/here will be get request path')
// this is like  ----->
// const API = new Request('/users')
.then(res=>console.log(res))
.catch(function (error) {
    console.log(error);
import {API} from './api'
API.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });
import {API} from './api'
API.delete('/user')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });
import {API} from './api'
API.put('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Package Sidebar

Install

npm i axios-lite

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

6.78 kB

Total Files

4

Last publish

Collaborators

  • piyas