How to use the mappersmith.default function in mappersmith

To help you get started, we’ve selected a few mappersmith examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tulios / mappersmith / example.js View on Github external
// 1) Import mappersmith
const forge = require('mappersmith').default
// import forge from 'mappersmith'

// 2) Forge your client with your API manifest
const github = forge({
  host: 'https://status.github.com',
  resources: {
    Status: {
      lastMessage: { path: '/api/last-message.json' }
    }
  }
})

// profit!
const response = await github.Status.lastMessage()

console.log(`status: ${response.data().body}`)
console.log(`loaded in ${response.timeElapsed}ms`)

mappersmith

It is a lightweight rest client for node.js and the browser

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis