@gemeentenijmegen/apiclient
TypeScript icon, indicating that this package has built-in type declarations

0.0.32 • Public • Published

Gemeente Nijmegen Api Client

An HTTP Api Client module. Used for applications requiring mutual TLS, backed by config in AWS.

How to use

Quickstart:

Install using npm:

npm i @gemeentenijmegen/apiclient

The client expects either the following environment parameters to be set, or to be provided a client certificate, private key and root ca:

  MTLS_PRIVATE_KEY_ARN // AWS Arn to the secrets manager ARN holding the private key
  MTLS_CLIENT_CERT_NAME // The name of an SSM parameter holding the client certificate 
  MTLS_ROOT_CA_NAME // The name of an SSM parameter holding the root ca

Example use:

// create a client
const apiClient = new ApiClient();
// init (get parameters from store etc.)
await apiClient.init();
// Use the client to perform a POST request and get responses.
const data = await apiClient.postData('/test', { data: 'test ' },  {'Content-type': 'application/json'});

// Use the client to perform a GET request and get data.
const data = await apiClient.getData('/test',  {'Content-type': 'application/json'});

The request can throw an error, the actual message is logged, a generic Error is thrown.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.32
154latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.32
154
0.0.31
36
0.0.30
1
0.0.29
0
0.0.28
2
0.0.27
2
0.0.26
2
0.0.25
1
0.0.24
2
0.0.23
3
0.0.22
3
0.0.21
2
0.0.20
1
0.0.19
0
0.0.18
2
0.0.17
0
0.0.16
1
0.0.15
2
0.0.143
0.0.132
0.0.120
0.0.112
0.0.101
0.0.91
0.0.82
0.0.71
0.0.60
0.0.50
0.0.412
0.0.30
0.0.21
0.0.11
0.0.097

Package Sidebar

Install

npm i @gemeentenijmegen/apiclient

Weekly Downloads

305

Version

0.0.32

License

EUPL-1.2

Unpacked Size

41.2 kB

Total Files

6

Last publish

Collaborators

  • jvanderborg
  • martijnvdijk
  • bramwithaar
  • marnixdessing
  • wkremer