middleware-logger
v1.4.0
Published
Repositório para o middleware de registro de log para o sistema BBCE
Downloads
53
Readme
bbce-middleware-logger
Repositório para o middleware de registro de log para o sistema BBCE
TODO LIST BEFORE FINISH
- [x] Atualiza comando de start com -Rf
- [ ] TSLINT => ESLINT
- [ ] Usar mais o
npx
- [ ] Garantir o tamanho baixo da imagem.
Libraries List
- axios
- jest
- TypeDI
- TypeORM
- uuidv4
Como Utilizar
Registrar o Middleware no arquivo de dependências:
Container.set("loggerMiddleware", LoggerMiddleware);
No index, adicione-o como middleware global. Além disso, será necessário especificar quais rotas possuem campos sensíveis e quais serão ocultados, na url deve ser passado um regex do path. Exemplo:
const routeWithSensitiveFields = [{
url: /^(\/[^\/]+){0,4}\/?$/gm,
method: methodEnum.POST,
fieldsToHide: {"sensitiveField1", "sensitiveField2"},
}]
const middleware = loggerMiddleware(
[
"path-to-your-kafka-broker-1:9092",
"path-to-your-kafka-broker-1:9094",
], routes);
app.use(middleware);
PS: O Middleware registra todas requisições diferentes de GET