@rapharacing/request

0.0.3 • Public • Published

Request

Axios wrapper for node to make a common request pattern

MIT License

Installation

Using npm:

npm i @rapharacing/request --save

Using Yarn:

yarn add @rapharacing/request

How to use

JavaScript

If the project supports ECMAScript Modules, you can use the import syntax

import request, { get, post, put, patch, remove } from "@rapharacing/request";

const requestUsers = async () => {
  const config = {
    method: "get",
    url: "/users"
  };

  const res = await request(config);
  const { data } = res.data;

  return data;
};

const requestUsers = async () => {
  const res = await get("/users");
  const { data } = res.data;

  return data;
};

const postUser = async user => {
  const res = await post("/user", user);
  const { data } = res.data;

  return data;
};

License

Request is freely distributable under the terms of the MIT license.

Package Sidebar

Install

npm i @rapharacing/request

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

9.58 kB

Total Files

6

Last publish

Collaborators

  • michaela_w
  • jakubgajewski
  • alex-windett
  • bbodien
  • john.kilpatrick