service-factory
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

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()

Readme

Keywords

none

Package Sidebar

Install

npm i service-factory

Weekly Downloads

0

Version

0.4.0

License

MIT

Last publish

Collaborators

  • janneh