@playful-systems/conduit
TypeScript icon, indicating that this package has built-in type declarations

0.9.0 • Public • Published

Conduit

An axios like http client that uses fetch under the hood.

NPM Package

Instantiating

import { Conduit } from '@packages/conduit';

const conduit = Conduit.create({
  baseURL: 'https://jsonplaceholder.typicode.com',
});

Requests

Conduit supports all the popular request methods.

GET

const response = await conduit.get('/posts');

POST

const response = await conduit.post('/posts', {
  title: 'foo',
  body: 'bar',
  userId: 1,
});

PUT

const response = await conduit.put('/posts/1', {
  id: 1,
  title: 'foo',
  body: 'bar',
  userId: 1,
});

PATCH

const response = await conduit.patch('/posts/1', {
  title: 'foo',
});

DELETE

const response = await conduit.delete('/posts/1');

Readme

Keywords

none

Package Sidebar

Install

npm i @playful-systems/conduit

Weekly Downloads

0

Version

0.9.0

License

none

Unpacked Size

12.6 kB

Total Files

7

Last publish

Collaborators

  • playful-bot
  • nwylynko