express-highstorm
v0.0.1
Published
A HTTP Logger Middleware for Express that streams the log-data to highstorm.app
Downloads
2
Maintainers
Readme
express-highstorm
ExpressJS Application Middleware to ingest request data from morgan
to highstorm.app.
Usage
Install the package in your express app.
npm i express-highstorm
Create a HttpLogger Instance
import { HttpLogger, HttpLoggerOptions } from "express-highstorm";
import dotenv from "dotenv";
dotenv.config();
// these are required options
const options: HttpLoggerOptions = {
token: process.env.HIGHSTORM_KEY!,
channelName: "morgan_highstorm",
format: "combined",
};
// creating new instance
export const httpLogger = new HttpLogger(options);
Putting the httpLogger
inside the express application.
import { httpLogger } from "./httpLogger";
import express, { Express } from "express";
const app: Express = express();
// calling the middleware option to get the express complaint morgan middleware
const middleware = httpLogger.middleware();
app.use(middleware);
app.get("/", (_, res) => {
res.json({ message: "hello" });
});
app.listen(3000, () => console.log("server started at port 3000"));
License
This project is under MIT License.