![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@irae/express-middleware-timer
Advanced tools
A simple timer implementation for debugging express middleware.
A simple timer implementation for debugging express middleware.
By default,
express-middleware-timer
does nothing. It's only activated when your application is started withTIMER=true
.
Note:
See examples for more detailed working examples.
// require module
var emt = require('express-middleware-timer');
// init timer
app.use(emt.init());
/***
* // custom report example
*
* app.use(emt.init(function report(req, res) {
* var report = emt.calculate(req,res);
* console.log('TIMER: %s %s %s',
* new Date(),
* report.request.url,
* JSON.stringify(report.timers));
* });
*
***/
// instrument middleware
app.use(emt.instrument(myMiddleware), 'myMiddleware');
// instrument array of middlewares
var middlewares = emt.instrument([
middlewareOne,
middlewareTwo,
middlewareThree
]);
middleware.forEach(function(middleware) {
app.use(middleware);
});
// routes
app.get('/', myRoute);
// start
app.listen(3000);
To enable your timer, start your application with TIMER=true
.
TIMER=true node ./app.js
# to start the example
TIMER=true node ./example/app1.js
Note:
See
examples/simple.js
for the code that generated this output.
{ request:
{ url: '/',
headers:
{ host: 'localhost:3000',
connection: 'keep-alive',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/30.0.1599.114 Chrome/30.0.1599.114 Safari/537.36',
'accept-encoding': 'gzip,deflate,sdch',
'accept-language': 'en-US,en;q=0.8',
'if-none-match': '"222957957"' } },
timers:
{ startup: { from_start: 0, took: 0 },
slowMiddleware: { took: 201, from_start: 201 },
fastMiddleware: { took: 0, from_start: 201 } } }
npm install
npm test
FAQs
A simple timer implementation for debugging express middleware.
We found that @irae/express-middleware-timer demonstrated a not healthy version release cadence and project activity because the last version was released 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.