@ryniaubenpm2/porro-incidunt-fugiat
v1.0.0
Published
Declarative library for describing endpoints.
Downloads
5
Maintainers
Keywords
Readme
@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);
}
}