1.1.3 • Published 1 year ago
midata-nodejs v1.1.3
MIDATA COOP NodeJS backend services library
This library provides communication functions with the MIDATA server. It may be used by backend services written for nodeJS.
Installation
Add
"midata-nodejs": "git+https://github.com/MIDATAcooperative/midata-nodejs.git"
to your package.json dependencies.
Backend testing
Run
npx midata-tester <server> <token>
in your project directory when prompted by the Midata portal in order to try out your backend service.
Usage of backend library
const midata = require('midata-nodejs');
Available functions:
midata.token()
- Returns current session tokenmidata.language()
- Returns language code of current user accountmidata.server()
- Returns base URL of Midata servermidata.userId()
- Returns ID of current usermidata.resourceId()
- Returns ID of current resourcemidata.receiveFHIRMessage()
- Returns JSON object with FHIR message that triggered your scriptmidata.answerFHIRMessage(jsonbundle)
- Send the JSON object which must be a FHIR bundle back to the servermidata.fhirRead(authToken, resourceType, id, version?)
- Reads a FHIR resource from the servermidata.fhirSearch(authToken, resourceType, params, unbundle)
- Does a FHIR search on the servermidata.fhirCreate(authToken, resource)
- Creates a new FHIR resource on the servermidata.fhirUpdate(authToken, resource)
- Updates an existing FHIR resource on the servermidata.fhirTransaction(authToken, bundle)
- Processes a bundle of actions on the servermidata.fhirOperation(authToken, operation, bundle)
- Performs an operation on the server