microservice-node-shared
v6.4.2
Published
Library standar for projects nodejs messangi
Downloads
103
Readme
Library standar for projects nodejs of messangi
Instalation
npm i microservice-node-shared
Import
import { Logs, CResponse, Transaction } from 'microservice-node-shared';
Functions Clases
Transaction.ID :void - Add the transactionID to the request, this it use in the middleware
Transaction.verify ( data: Iverify { region: string; accessKeyId: string; secretAccessKey: string; aliasName: string, token: string; }): { ok: boolean, decoded?: {} } - this function is for to evaluate the token
CResponse.response(request: Request, response: Response, status: number, customData?: {} ) - use this function for return
new Logs().info('NanmeFile', 'Message example', request?: Request, env?: {} ) - this function is for create logs type info(), debug(), warning(), error() in a file txt, and can register in the elasticsearch if you pass the request and the env with the url of the elasticsearch env = { urlElasticsearch: 'XXXX' }
File of environment variable
this file must have one key for the URL of elasticsearch with the name urlElasticsearch
, see the example
// file env.ts
export const env = {
urlElasticsearch: string,
region: string;
accessKeyId: string;
secretAccessKey: string;
aliasName: string,
}