trinity-modules

1.0.4 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i trinity-modules

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

6.17 kB

Total Files

6

Last publish

Collaborators

  • 66houdini