Skip to content

A lib to convert request-response pair of different contracts, load a translate description from a config

Notifications You must be signed in to change notification settings

node-tools/api-adapter

Repository files navigation

LzApiAdapter

const config = {
  name: "home1",
  host: "https://b2ads.ad5track.com",
  path: "/ad_products/top",
  method: "GET",
  properties: [
    { from: "headers.referrer", to: "query.referrer" },
    { from: "query.size" , to: "query.limit"},
    { from: "query.userId" , to: "query.user_id"}
  ]
}

const apiAdapter = new ApiAdapter(config)


console.log(apiAdapter.fromApi({
  headers: { referrer: "http://www.americanas.com "},
  query: { size: 10, userId: 30, term: "notebook"}
}))

About

A lib to convert request-response pair of different contracts, load a translate description from a config

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published