
Research
/Security News
CanisterWorm: npm Publisher Compromise Deploys Backdoor Across 29+ Packages
The worm-enabled campaign hit @emilgroup and @teale.io, then used an ICP canister to deliver follow-on payloads.
response-time
Advanced tools
Response time for Node.js servers.
This module creates a middleware that records the response time for requests in HTTP servers. The "response time" is defined here as the elapsed time from when a request enters this middleware to when the headers are written out to the client.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install command:
$ npm install response-time
var responseTime = require('response-time')
Create a middleware that adds a X-Response-Time header to responses. If
you don't want to use this module to automatically set a header, please
see the section about responseTime(fn).
The responseTime function accepts an optional options object that may
contain any of the following keys:
The fixed number of digits to include in the output, which is always in
milliseconds, defaults to 3 (ex: 2.300ms).
The name of the header to set, defaults to X-Response-Time.
Boolean to indicate if units of measurement suffix should be added to
the output, defaults to true (ex: 2.300ms vs 2.300).
Create a new middleware that records the response time of a request and
makes this available to your own function fn. The fn argument will be
invoked as fn(req, res, time), where time is a number in milliseconds.
var express = require('express')
var responseTime = require('response-time')
var app = express()
app.use(responseTime())
app.get('/', function (req, res) {
res.send('hello, world!')
})
var finalhandler = require('finalhandler')
var http = require('http')
var responseTime = require('response-time')
// create "middleware"
var _responseTime = responseTime()
http.createServer(function (req, res) {
var done = finalhandler(req, res)
_responseTime(req, res, function (err) {
if (err) return done(err)
// respond to request
res.setHeader('content-type', 'text/plain')
res.end('hello, world!')
})
})
var express = require('express')
var responseTime = require('response-time')
var StatsD = require('node-statsd')
var app = express()
var stats = new StatsD()
stats.socket.on('error', function (error) {
console.error(error.stack)
})
app.use(responseTime(function (req, res, time) {
var stat = (req.method + req.url).toLowerCase()
.replace(/[:.]/g, '')
.replace(/\//g, '_')
stats.timing(stat, time)
}))
app.get('/', function (req, res) {
res.send('hello, world!')
})
Morgan is an HTTP request logger middleware for Node.js. It logs details about incoming requests, including response times, to the console or a file. While it provides more comprehensive logging capabilities compared to response-time, it is not specifically focused on measuring response times.
Express Status Monitor is a simple, self-hosted module based on Socket.io and Chart.js to report realtime server metrics for Express-based applications. It provides a web-based dashboard to monitor various metrics, including response times, making it more feature-rich compared to response-time.
Prom-client is a Prometheus client for Node.js that allows you to instrument your application with custom metrics, including response times. It provides more flexibility and integration with Prometheus for monitoring and alerting, but requires more setup compared to response-time.
FAQs
Response time for Node.js servers
The npm package response-time receives a total of 343,306 weekly downloads. As such, response-time popularity was classified as popular.
We found that response-time demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers 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.

Research
/Security News
The worm-enabled campaign hit @emilgroup and @teale.io, then used an ICP canister to deliver follow-on payloads.

Research
/Security News
Attackers compromised Trivy GitHub Actions by force-updating tags to deliver malware, exposing CI/CD secrets across affected pipelines.

Security News
ENISA’s new package manager advisory outlines the dependency security practices companies will need to demonstrate as the EU’s Cyber Resilience Act begins enforcing software supply chain requirements.