Socket
Socket
Sign inDemoInstall

@gemeentenijmegen/apiclient

Package Overview
Dependencies
141
Maintainers
5
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gemeentenijmegen/apiclient

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


Version published
Weekly downloads
278
decreased by-10.61%
Maintainers
5
Created
Weekly downloads
 

Readme

Source

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.

FAQs

Last updated on 02 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc