3.0.1 • Published 3 years ago

@freepi/core v3.0.1

Weekly downloads
48
License
MIT
Repository
github
Last release
3 years ago

FreePI Core Library

Description

The core library for FreePI. Contains logic that needs to be shared between packages.

Installation

How To Use

To install FreePI

$ npm install freepi

To install package individually, run the following in your terminal.

$ npm install @freepi/unsplash

Features:

  • RequestBuilder
  • requests
  • utils

How To Use

To import the whole core library:

import { core } from "freepi";

# OR

import core from "@freepi/core";

requests

To use the requests library:

Import the request methods from the requests object

Available methods are:

  • get
  • post
  • del
  • put

All methods take two arguments: a url (or path) and a config object. The config object is where additional information like headers, data, or query parameters are passed.

To use requests methods

import { requests } from '@freepi/core';

const { get, post, del, put } = requests;

const queryParams = {
  id: 100,
};

get<Todo>('https://my.site.com/api/todos', { params: queryParams });
// the request will return an Axios promise of the type specified

To use customReqInit:
customReqInit allows use of request methods using a custom instance of axios you can optionally pass a config object which will be used to create the custom axios instance.

import { customReqInit } from '@freepi/core';

const requests = customReqInit({ baseURL: 'https://my.app.com' });
// all native methods available in the request library will
// now use the custom axios instance
requests.get('/path'); // will use baseURL set using config

Bug Reports and Feedback

Any bug reports or feedback for this library should be directed to the github issues page

2.2.3-alpha.0

3 years ago

2.2.4-alpha.0

3 years ago

3.0.1

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.1-alpha.0

3 years ago

2.2.0-alpha.0

3 years ago

2.1.3-alpha.0

3 years ago

2.1.2-alpha.0

3 years ago

2.1.1-alpha.0

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.0.4-alpha.0

3 years ago

2.0.5-alpha.0

3 years ago

2.1.0

3 years ago

2.0.3-alpha.0

3 years ago

2.0.2-alpha.0

3 years ago

2.0.1-alpha.0

3 years ago

2.0.0-alpha.0

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

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

0.0.2

3 years ago

0.0.1

3 years ago