
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Lightweight Express middleware for logging request performance, response time, and analytics.
expresseye is a lightweight Express middleware designed to monitor API request performance, log request details, and send email alerts for slow requests. This helps developers optimize their APIs by identifying slow endpoints and analyzing traffic patterns.
expresseye?npm install expresseye
or
yarn add expresseye
import dotenv from "dotenv";
import path from "path";
import express, { Request, Response } from "express";
import { requestProfilerMiddleware } from "expresseye";
dotenv.config({ path: path.resolve(__dirname, "../.env") });
const app = express();
const email = process.env.EMAIL_ADDRESS;
const password = process.env.EMAIL_APP_PASSWORD;
app.use(requestProfilerMiddleware({
logTo: "file",
filePath: "./logs",
fileName: "requests.log",
threshold: 300,
logLimit: 20,
logWindowMs: 60000,
ignoreRoutes: ["/health"],
sendEmailAlert: false,
alertEmail: email,
senderEmail: email,
senderPassword: password,
latencyThreshold: 1,
emailLimit: 3,
emailWindowMs: 600000,
routesToMonitor: ["/"]
}));
app.get("/", (req: Request, res: Response) => {
res.status(200).send("Hello World!");
});
app.get("/health", (req: Request, res: Response) => {
res.status(200).send("OK");
});
app.listen(3000, () => console.log("Server running on port 3000"));
Below are the configurable arguments with their default values and descriptions:
| Option | Type | Default Value | Description |
|---|---|---|---|
logTo | string | "console" | "console" or "file" (where to log requests). |
filePath | string | "" | Path for log files if logTo is "file". |
fileName | string | "" | File name for log storage. |
threshold | number | 500 | Minimum response time (ms) to log a request. |
logLimit | number | 10 | Max logs per IP within logWindowMs. |
logWindowMs | number | 60000 | Time window for log limit in ms. |
ignoreRoutes | string[] | [] | Routes to exclude from logging. |
sendEmailAlert | boolean | false | If true, sends email alerts for slow requests. |
alertEmail | string | "" | Email address to receive alerts. |
senderEmail | string | "" | Email address used to send alerts. |
senderPassword | string | "" | App password for sender email. |
latencyThreshold | number | 1000 | If request takes more than this (ms), an alert is triggered. |
emailLimit | number | 5 | Max emails sent within emailWindowMs. |
emailWindowMs | number | 600000 | Time window for email alerts in ms. |
routesToMonitor | string[] | [] | Specific routes to monitor for slow responses. |
alertEmail to your email).alertEmail to a different email).Add the following to your .env file:
EMAIL_ADDRESS=your.email@provider.com
EMAIL_APP_PASSWORD=your-generated-app-password
| Scenario | Config | Expected Behavior |
|---|---|---|
| Log all requests to a file | logTo: "file", filePath: "../logs" | Requests get logged in ../logs/requests.log. |
| Send email alerts when response time > 1s | latencyThreshold: 1000, sendEmailAlert: true | If a request takes >1s, an email alert is sent. |
Ignore /health route | ignoreRoutes: ["/health"] | /health requests won't be logged. |
| Limit logging to 20 requests per IP in 1 min | logLimit: 20, logWindowMs: 60000 | Prevents spam logging from a single user. |
sendEmailAlert is set to true.alertEmail and senderEmail are correctly configured.logTo is set to "file".filePath and fileName are correctly set.This project is developed and maintained by Satyam Jha.
This project is licensed under the MIT License and open for contributions!
FAQs
Lightweight Express middleware for logging request performance, response time, and analytics.
We found that expresseye demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.