1.5.6 • Published 4 years ago

nfetch v1.5.6

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

nFetch

Simplified HTTP request client (< 1kb)

npm bundlephobia npm

Config

Methods and Structures

Methods For convenience aliases have been provided for all supported request methods.

nfetch.get = (url: string, configs?: IConfig)
nfetch.delete = (url: string, data?: object, configs?: IConfig)
nfetch.post = (url: string, data: object, configs?: IConfig)
nfetch.put = (url: string, data: object, configs?: IConfig)

Configs Structure

IConfig {
  baseURL?: string;
  cache?: RequestCache;
  credentials?: RequestCredentials;
  headers?: Headers;
  integrity?: string;
  keepalive?: boolean;
  method?: RequestMethod;
  mode?: RequestMode;
  referrerPolicy?: ReferrerPolicy;
  timeout?: number;
}

Response Structure

Response {
  url: string;
  data?: any;
  status: number;
  headers?: Headers;

  /**
   * Funcional only in Typescript
   * T: Something `Class` as parameter
   */
  public toObject<T>() {}
}

Configure API

import { nfetch } from 'nfetch';

const api = new nfetch({ baseUrl: 'https://jsonplaceholder.typicode.com' })

api.get('/posts')
  .then(res => console.log(res.data))
  .catch(error => console.log(error))

Docs Parameters

Click here to view doc of parameters

Demo

Click here to view in Browser: nfetch | Requests | API | Simple Example

1.5.6

4 years ago

1.5.5

4 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.9

4 years ago

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago