express-system-status
Advanced tools
Comparing version 0.1.0 to 0.2.0
40
ex/ex.js
@@ -7,2 +7,37 @@ var express = require('express') | ||
} | ||
//var mongoose = require('mongoose') | ||
// mongoose.Promise = Promise; | ||
// var options = { | ||
// // db: { native_parser: true }, | ||
// // server: { poolSize: 5 }, | ||
// // replset: { rs_name: 'myReplicaSetName' }, | ||
// // user: 'myUserName', | ||
// // pass: 'myPassword' | ||
// } | ||
// mongoose.connect('mongodb://localhost/blog', options); | ||
// var blogSchema = mongoose.Schema({ | ||
// created: { | ||
// type: Date, | ||
// default: Date.now | ||
// }, | ||
// title: { | ||
// type: String, | ||
// required: true, | ||
// trim: true | ||
// }, | ||
// content: { | ||
// type: String, | ||
// required: true, | ||
// trim: true | ||
// }, | ||
// author: { | ||
// type: String, | ||
// required: true, | ||
// trim: true | ||
// }, | ||
// }); | ||
// var Blog = mongoose.model('Blog', blogSchema) | ||
app.use('/api/v1/system/status', | ||
@@ -15,3 +50,4 @@ status({ | ||
pass: 'pass', | ||
extra: {} | ||
extra: {}, | ||
//mongoose:mongoose | ||
}) | ||
@@ -21,3 +57,3 @@ ) | ||
app.get('/', function (req, res) { | ||
res.send('This is the index route. You are probably looking for the <a href="/api/v1/system/status">System Status</a> route!') | ||
res.send('This is the index route. You are probably looking for the <a href="/api/v1/system/status/api">System Status</a> route!') | ||
}) | ||
@@ -24,0 +60,0 @@ app.listen(3000, function () { |
159
index.js
@@ -31,2 +31,71 @@ 'use strict' | ||
function createObj (data) { | ||
var obj = { | ||
process: { | ||
versions: process.versions, | ||
arch: process.arch, | ||
platform: process.platform, | ||
argv: process.argv, | ||
pid: process.pid, | ||
release: process.release, | ||
uptime: process.uptime() | ||
}, | ||
os: { | ||
EOL: os.EOL, | ||
arch: os.arch(), | ||
cpus: os.cpus(), | ||
cpuCount: os.cpus().length, | ||
endianness: os.endianness(), | ||
freemem: os.freemem() / (1024 * 1024), | ||
freememPercentage: os.freemem() / os.totalmem(), | ||
homedir: os.homedir(), | ||
hostname: os.hostname(), | ||
loadavg: os.loadavg(), | ||
networkInterfaces: os.networkInterfaces(), | ||
platform: os.platform(), | ||
release: os.release(), | ||
tmpdir: os.tmpdir(), | ||
totalmem: os.totalmem() / (1024 * 1024), | ||
type: os.type(), | ||
uptime: os.uptime() | ||
}, | ||
dns: { | ||
servers: dns.getServers() | ||
}, | ||
global: { | ||
__dirname: __dirname, | ||
__filename: __filename | ||
} | ||
} | ||
if (data.extra) { | ||
obj.extra = data.extra | ||
} | ||
if (data.config) { | ||
obj.config = data.config | ||
} | ||
if (data.app) { | ||
obj.express = { | ||
settings: data.app.settings, | ||
locals: data.app.locals | ||
} | ||
} | ||
if (data.mongoose) { | ||
obj.mongoose = { | ||
replica: data.mongoose.connection.replica, | ||
hosts: data.mongoose.connection.hosts, | ||
host: data.mongoose.connection.host, | ||
port: data.mongoose.connection.port, | ||
user: data.mongoose.connection.user, | ||
options: data.mongoose.connection.options, | ||
config: data.mongoose.connection.config, | ||
name: data.mongoose.connection.name, | ||
models: data.mongoose.modelSchemas, | ||
readyState: data.mongoose.connection.readyState === 0 ? 0 : 1, | ||
closeCalled: data.mongoose.connection._closeCalled, | ||
hasOpened: data.mongoose.connection._hasOpened, | ||
listening: data.mongoose.connection._listening | ||
} | ||
} | ||
return obj | ||
} | ||
// 'darwin', 'freebsd', 'linux', 'sunos' or 'win32' | ||
@@ -49,96 +118,10 @@ module.exports = function (data) { | ||
status.get('/status.html', function (req, res) { | ||
var obj = { | ||
process: { | ||
versions: process.versions, | ||
arch: process.arch, | ||
platform: process.platform, | ||
argv: process.argv, | ||
pid: process.pid, | ||
release: process.release, | ||
uptime: process.uptime() | ||
}, | ||
express: { | ||
settings: data.app.settings, | ||
locals: data.app.locals | ||
}, | ||
config: data.config || {}, | ||
os: { | ||
EOL: os.EOL, | ||
arch: os.arch(), | ||
cpus: os.cpus(), | ||
cpuCount: os.cpus().length, | ||
endianness: os.endianness(), | ||
freemem: os.freemem() / (1024 * 1024), | ||
freememPercentage: os.freemem() / os.totalmem(), | ||
homedir: os.homedir(), | ||
hostname: os.hostname(), | ||
loadavg: os.loadavg(), | ||
networkInterfaces: os.networkInterfaces(), | ||
platform: os.platform(), | ||
release: os.release(), | ||
tmpdir: os.tmpdir(), | ||
totalmem: os.totalmem() / (1024 * 1024), | ||
type: os.type(), | ||
uptime: os.uptime() | ||
}, | ||
dns: { | ||
servers: dns.getServers() | ||
}, | ||
global: { | ||
__dirname: __dirname, | ||
__filename: __filename | ||
}, | ||
extra: data.extra || {} | ||
} | ||
res.render(path.resolve('client/index.html'), { | ||
obj: obj | ||
obj: createObj(data) | ||
}) | ||
}) | ||
status.get('/api', function (req, res) { | ||
var obj = { | ||
process: { | ||
versions: process.versions, | ||
arch: process.arch, | ||
platform: process.platform, | ||
argv: process.argv, | ||
pid: process.pid, | ||
release: process.release, | ||
uptime: process.uptime() | ||
}, | ||
express: { | ||
settings: data.app.settings, | ||
locals: data.app.locals | ||
}, | ||
config: data.config || {}, | ||
os: { | ||
EOL: os.EOL, | ||
arch: os.arch(), | ||
cpus: os.cpus(), | ||
cpuCount: os.cpus().length, | ||
endianness: os.endianness(), | ||
freemem: os.freemem() / (1024 * 1024), | ||
freememPercentage: os.freemem() / os.totalmem(), | ||
homedir: os.homedir(), | ||
hostname: os.hostname(), | ||
loadavg: os.loadavg(), | ||
networkInterfaces: os.networkInterfaces(), | ||
platform: os.platform(), | ||
release: os.release(), | ||
tmpdir: os.tmpdir(), | ||
totalmem: os.totalmem() / (1024 * 1024), | ||
type: os.type(), | ||
uptime: os.uptime() | ||
}, | ||
dns: { | ||
servers: dns.getServers() | ||
}, | ||
global: { | ||
__dirname: __dirname, | ||
__filename: __filename | ||
}, | ||
extra: data.extra || {} | ||
} | ||
res.status(200).send(obj) | ||
res.status(200).send(createObj(data)) | ||
}) | ||
return status | ||
} |
{ | ||
"name": "express-system-status", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Add routes to check the env , configs & status of your system", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
# express-system-status | ||
# Express-System-Status | ||
Add Routes to check the env , configs & status of your system | ||
@@ -27,3 +27,4 @@ | ||
pass: 'pass', | ||
extra: {} | ||
extra: {}, | ||
mongoose:mongoose //Now Supporting Mongoose | ||
}) | ||
@@ -67,2 +68,10 @@ ) | ||
… | ||
}, | ||
mongoose: { | ||
readyState: 1, | ||
closeCalled: false, | ||
hasOpened: true, | ||
listening: false, | ||
models:{…}, | ||
… | ||
} | ||
@@ -78,3 +87,12 @@ } | ||
- Refactor | ||
- Update Tests | ||
Change Log | ||
--------------------------------- | ||
### 0.1.0 | ||
- Init Release | ||
### 0.2.0 | ||
- Added Mongoose Support | ||
License | ||
@@ -110,9 +128,8 @@ --------------------------------- | ||
Support and contributions from the open source community are essential for keeping | ||
Mean Stack JS up to date. We are always looking for the quality contributions and | ||
express-system-status up to date. We are always looking for the quality contributions and | ||
will be happy to accept your Pull Requests as long as those adhere to some basic rules: | ||
* Please make sure that your contribution fits well in the project's style & concept: | ||
* JS Standard | ||
* John Papa angular style guide | ||
* Pass All Test ( once testing has been fully implement) | ||
* JS Standard | ||
* Pass All Test ( once testing has been fully implement) | ||
@@ -122,3 +139,3 @@ ### Creating an Issue | ||
Before you create a new Issue: | ||
* Check the [Issues](https://github.com/GreenPioneer/meanstackjs/issues) on Github to ensure one doesn't already exist. | ||
* Check the [Issues](https://github.com/greenpioneersolutions/express-system-status/issues) on Github to ensure one doesn't already exist. | ||
* Place use one of these topics in the beginning of your issue title- Contrib, Hotfix, Error, Help or Feature. | ||
@@ -125,0 +142,0 @@ * Clearly describe the issue, including the steps to reproduce the issue. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15144
189
154