@ryniaubenpm2/porro-incidunt-fugiat

1.0.0 • Public • Published

@ryniaubenpm2/porro-incidunt-fugiat

Declarative library for describing endpoints.

Install

npm:

npm install @ryniaubenpm2/porro-incidunt-fugiat

yarn:

yarn add @ryniaubenpm2/porro-incidunt-fugiat

Usage

Describe your request scheme

import @ryniaubenpm2/porro-incidunt-fugiat from '@ryniaubenpm2/porro-incidunt-fugiat';

export const requests = @ryniaubenpm2/porro-incidunt-fugiat('10.16.0.140', 9001)
    .group('list', {
        get: {
            all: 'get-all-lists',
        },
        post: {
            save: 'save-list',
            create: 'get-empty-list'
        }
    })
    .group('ports', {
        get: {
            ports: (count) => `get-ports?count=${count}`,
        }
    })
    .end();

And send your requests to any place

import { requests } from 'requests';

const showLists = async () => {
    try {
        const response = await fetch(requests.list.get.all);
        const answer = await response.json();
        console.log(answer);
    } catch (error) {
        console.error(error);
    }
}
import { requests } from 'requests';
import axios from 'axios';

const showLists = async () => {
    try {
        const response = await axios.get(requests.list.get.all);
        console.log(response.data);
    } catch (error) {
        console.error(error);
    }
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @ryniaubenpm2/porro-incidunt-fugiat

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

14.1 kB

Total Files

8

Last publish

Collaborators

  • mi762136