Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
ojizero 5aa0d9460c
restructure method, split client into interface and implementation
il y a 1 an
src restructure method, split client into interface and implementation il y a 1 an
test restructure method, split client into interface and implementation il y a 1 an
.gitignore futher setup and module skeleton il y a 1 an
.npmignore futher setup and module skeleton il y a 1 an
LICENSE Initial commit il y a 1 an
README.md futher setup and module skeleton il y a 1 an
package-lock.json futher setup and module skeleton il y a 1 an
package.json restructure method, split client into interface and implementation il y a 1 an
tsconfig.json restructure method, split client into interface and implementation il y a 1 an
tsconfig.spec.json restructure method, split client into interface and implementation il y a 1 an

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