Files
openstapps/README.md
2019-01-29 16:04:03 +01:00

1.2 KiB

@openstapps/minimal-connector

Prerequisites:

  • node (version 10+) and npm installed

  • a backend, which is running locally (on http://localhost:3000) --- for testing purposes, it is advisable to use minimal-deployment project

How to get started

To install all needed npm packages:

npm install

To prepare the script to be executed, run:

npm run build

To execute the code in "CLI" script (basically to execute the connector):

node lib/cli.js

To run some sample tests, use:

npm test

The npm scripts are defined in package.json file.

Code structure

File src/main.ts contains:

  • MinimalConnector as class with sample getItems() method, which simulates fetching of items from a resource and validator property which is useful for validating items against StAppsCore
  • sample indexing methods: parse, bulk, index and finish

File src/cli.ts contains:

  • instantiation of a client
  • calls to asynchronous indexing methods using auto method of async library

File test/MinimalConnector.spec.ts contains sample test suite using mocha and chai.