代码拉取完成,页面将自动刷新
Simple express/connect middleware to provide an "apache-like" /status.html
page.
npm install mod_status
var express = require('express'),
status = require('../lib/index.js');
var app = express();
app.use(status({
url: '/status',
version: true,
uptime: true,
check: function(req) {
if (req.something == false) {
return false; //Don't show status
}
return true; //Show status
}
}));
console.log('Go to: http://127.0.0.1:8000/status');
app.listen(8000);
url
- The URL to respond to, defaults to /status.html
version
- Show the Node.js version in the output. Default: false
uptime
- Show the uptime of the process in the output: Default: false
text
- Provide custom response text, will override all the above. Default: null
check
- A function to check the request to see if the status page should be shown. Default: returns true to always show
OK
- DefaultOK - NodeJS: v0.10.17
- From version: true
OK - Uptime: 2 days, 3 hours, 4 minutes
- From uptime: true
OK - NodeJSL v0.10.17 - Uptime: 2 days, 3 hours, 4 minutes
- From uptime: true & version: true
WORKS
- From text: 'WORKS'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。