0.1.2 • Published 1 year ago

@fountane/httpmethod v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

httpmethod

A simple SDK method builder based on templates similar to Loopback 3

Usage

const { createApp } = require('@fountane/httpmethod')
const { requestor: axiosRequestor } = require('@fountane/httpmethod/axios')

const app = createApp(axiosRequestor)

app.addMethod({
  method: 'GET',
  name: 'fetchTodos',
  url: 'https://jsonplaceholder.typicode.com/todos/#{{id}}',
})

// somewhere else in the codebase

const response = await app.fetchTodos({
  id,
})

response //=> axios response ({data,request,config,...etc})