trinity-modules
v1.0.4
Published
request and response logger for express
Downloads
10
Readme
TRINITY MIDDLEWARE
Trinity middleware contains series of middleware that helps monitor request&response through your API
Installation
Use the package manager npm to install the middleware.
npm i trinity-modules
Usage
//with express
const express = require('express');
const {InfoLogger, unknownEndpoint, errorHandler} = require("trinity-modules/utils/middleware")
const app = express();
const PORT = process.env.PORT
const logger = infoLogger("API_KEY")
app.use(logger);
app.get('/', (req, res) => {
res.json("up and running")
});
//other app routes
app.use(unknownEndpoint);
app.use(errorHandler);
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.