1.0.4 • Published 1 year ago

trinity-modules v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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.

License

MIT

1.0.4

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.3

1 year ago

1.0.0

1 year ago