0.0.31 • Published 5 months ago

@gemeentenijmegen/apiclient v0.0.31

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
5 months ago

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.

0.0.20

12 months ago

0.0.21

11 months ago

0.0.22

11 months ago

0.0.23

10 months ago

0.0.24

9 months ago

0.0.25

9 months ago

0.0.30

6 months ago

0.0.31

5 months ago

0.0.26

9 months ago

0.0.27

8 months ago

0.0.28

8 months ago

0.0.29

7 months ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.14

1 year ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago