mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
feat: add minimal connector
This commit is contained in:
43
README.md
Normal file
43
README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# minimal-connector
|
||||
|
||||
## Prerequisites:
|
||||
|
||||
* `node` (version 8+) 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:
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
To prepare the script to be executed, run:
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
To execute the code in "CLI" script (basically to execute the connector):
|
||||
```sh
|
||||
node lib/cli.js
|
||||
```
|
||||
|
||||
To run some sample tests, use:
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
The `npm` scripts are defined in `package.json` file.
|
||||
|
||||
## Code structure
|
||||
|
||||
File [src/main.ts](src/index.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](src/cli.ts) contains:
|
||||
* instantiation of a client
|
||||
* calls to asynchronous indexing methods using `auto` method of `async` library
|
||||
|
||||
File [test/MinimalConnector.spec.ts](test/MinimalConnector.spec.ts) contains sample test suite using `mocha` and `chai`.
|
||||
Reference in New Issue
Block a user