Skip to content

Commit 7efd0e2

Browse files
committed
Example with connect and express
1 parent 50cbf85 commit 7efd0e2

File tree

2 files changed

+26
-55
lines changed

2 files changed

+26
-55
lines changed

connect_test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var miniprofiler = require('./miniprofiler.js');
2+
var express = require('express');
3+
var connect = require('connect');
4+
5+
// Defaults to 'left'. Uncomment this to move to right. Also supports 'bottomLeft', 'bottomRight'.
6+
/*
7+
miniprofiler.configure({
8+
popupRenderPosition: 'right'
9+
});
10+
*/
11+
12+
var app = express();
13+
app.use(miniprofiler.profile());
14+
15+
app.get('/', function(req, res) {
16+
function done() {
17+
res.send('<html><body>hello' + req.miniprofiler.include() + '</body></html>');
18+
}
19+
function query(arg) {
20+
console.log('arg', arg); // arg == 'some argument'
21+
setTimeout(done, 234);
22+
}
23+
req.miniprofiler.timeQuery('sql', 'SELECT * FROM TEST', query, 'some argument');
24+
});
25+
26+
app.listen(8080);

test_app.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)