Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
ojizero bf448819fb
resource class and tests
pirms 3 gadiem
src resource class and tests pirms 3 gadiem
test resource class and tests pirms 3 gadiem
.gitignore futher setup and module skeleton pirms 3 gadiem
.npmignore futher setup and module skeleton pirms 3 gadiem
LICENSE Initial commit pirms 3 gadiem
README.md futher setup and module skeleton pirms 3 gadiem
package-lock.json workout on method specification pirms 3 gadiem
package.json workout on method specification pirms 3 gadiem
tsconfig.json resource class and tests pirms 3 gadiem
tsconfig.spec.json restructure method, split client into interface and implementation pirms 3 gadiem

README.md

# portal > HTTP API clients ... simplified.

Installation

npm install --save @ojizero/portal

Usage

Aimed to be used as a building block for API client libraries

/// In your library or definition file
import portal from '@ojizero/portal'

const client = portal({ baseUrl: 'some.base.url' }) // Initial configuration can be passed here

// Get method without path variables
client.route('someGetMethod', { path: '/some/path' })

// Get method with path variables
client.route('someGetMethodWithParam', { path: '/some/path/:withInnerVariable' })

export default client

/* ******************* */

/// In your application
import YourClient from 'your-client-module'

const client = YourClient() // You can also pass additional options to futher configure the client

const someGetMethodPromise = client.someGetMethod() // GET http://some.base.url/some/path
const someGetMethodWithParamPromise = client.someGetMethodWithParam(5) // GET http://some.base.url/some/path/5