57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
var express = require('express');
|
|
var router = express.Router();
|
|
var util = require('util');
|
|
var mysql = require('mysql');
|
|
var moment = require('moment');
|
|
var fs = require('fs');
|
|
|
|
var utils = require('../../../src/utils');
|
|
var crossCtl = require('../../../src/crossCtl');
|
|
|
|
var path = require('path');
|
|
|
|
var passport = require('passport');
|
|
|
|
// operation
|
|
/*
|
|
router.use(function (req, res, next) {
|
|
|
|
|
|
next()
|
|
})
|
|
*/
|
|
/*
|
|
router.use(function (req, res, next) {
|
|
if (req.infos.userInfo.adminFlag === false) {
|
|
res
|
|
.status(401)
|
|
.render("main/pages/error", {
|
|
infos: req.infos,
|
|
errorCode: 401,
|
|
errorMessage: "Unauthorized",
|
|
});
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
*/
|
|
|
|
router.get('/heapdump', function (req, res) {
|
|
utils.doHeapdump(
|
|
crossCtl.sConfig.debug,
|
|
'heapsnapshot_of_' +
|
|
crossCtl.sConfig.sid +
|
|
'_' +
|
|
utils.getNow().replace(' ', '_') +
|
|
'.heapsnapshot',
|
|
function (error, resultPath) {
|
|
console.log('heapsnapshot saved...');
|
|
res.send(
|
|
JSON.stringify({ whoami: 'pond-one', message: 'heapdumped...' })
|
|
);
|
|
}
|
|
);
|
|
});
|
|
|
|
module.exports = router;
|