Package Exports
- @applicaster/zapp-pipes-dev-kit
- @applicaster/zapp-pipes-dev-kit/lib/app-pipes
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@applicaster/zapp-pipes-dev-kit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
zapp-pipes-dev-kit
This project contains the Zapp-pipes development kit to develop, test, and deploy zapp-pipes bundles.
How to use
The dev kit enables to different modes for running a zapp-pipes bundle :
- server mode : creates a node.js server which can be used for testing requests.
- library mode : creates a bundle which can be used directly inside an app
the Dev Kit is not intended to build production bundles - but only as a way to develop and test new providers.
Installation
- with npm : run
yarn add @applicaster/zapp-pipes-dev-kitor - clone this repo locally, install dependencies, and require it by its path
API :
server mode
- Import the
createZappPipesServerfunction from the dev kit. This function takes an configuration object as parameter, and returns the full hapi server object, plus a function to start the server
// signature
const config = {
options: { port: 8080, host: 'localhost' }, // optionnal. these are the default values
providers: [providers] // array of providers to load
};
// returns
server = {
..hapiServerObject, // hapi server
startServer // function to start the server
}
- Import your provider(s) from other packages or local code, then invoke the method.
import { createZappPipesServer } from 'zapp-pipes-dev-kit';
import provider from 'your-provider-packeage';
const zappPipesServer = createZappPipesServer({ providers: [provider] });
// zappPipesServer contains the full Hapi properties so you can add routes, invoke the start function directly, etc...
// or simply start the server with its basic configuration
zappPipesServer.startServer();
you can then visit http://{host}:{port} to test the requests
Library mode
The library mode is used to package the provider(s) as they would when they are built for the app follow these steps :
- Import the
createZappPipesLibraryfunction. This functions take an array of providers as parameters, and returns thegetfunction which is the entry point of the zapp-pipes js bundle
import { createZappPipesLibrary } form 'zapp-pipes-dev-kit';
import provider form 'path-to-your-provider';
const get = createZappPipesLibrary([provider]);
// you can then use this get method like the app would, with a url and a callback :
get('provider-name://fetchData?type=XXX¶m=YYY', console.log);
For development
- Clone this repo
- Install dependencies with
yarnornpm install