service-factory
v0.4.0
Published
Declarative HTTP client builder
Downloads
7
Readme
service-factory
Declarative HTTP client builder
Install
$ npm install --save service-factory
Usage
import ServiceFactory from "service-factory"
const declaration = {
listUsers: {
method: "GET",
url: "/users"
},
findUser: {
method: "GET",
url: "/users/:id"
},
createUser: {
method: "POST",
url: "/users"
}
}
const service = ServiceFactory.baseUrl("www.example.com").create(declaration)
const users = await service.listUsers()