UNPKG

@wristband/express-auth

Version:

SDK for integrating your ExpressJS application with Wristband. Handles user authentication and token management.

30 lines (29 loc) 1.03 kB
import axios from 'axios'; import http from 'http'; import https from 'https'; import { FORM_URLENCODED_MEDIA_TYPE, JSON_MEDIA_TYPE } from './utils/constants'; export class WristbandApiClient { constructor(wristbandApplicationDomain) { this.axiosInstance = axios.create({ baseURL: `https://${wristbandApplicationDomain}/api/v1`, httpAgent: new http.Agent({ keepAlive: true, maxSockets: 100, maxFreeSockets: 10, timeout: 60000, keepAliveMsecs: 1000, scheduling: 'lifo', }), httpsAgent: new https.Agent({ keepAlive: true, maxSockets: 100, maxFreeSockets: 10, timeout: 60000, keepAliveMsecs: 1000, scheduling: 'lifo', }), headers: { 'Content-Type': FORM_URLENCODED_MEDIA_TYPE, Accept: JSON_MEDIA_TYPE }, maxRedirects: 0, }); } }