initial commit
This commit is contained in:
parent
1b190226f0
commit
ad459668db
3 changed files with 108 additions and 0 deletions
27
iisnode.yml
Normal file
27
iisnode.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# For documentation see https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/iisnode.yml
|
||||||
|
|
||||||
|
# loggingEnabled: false
|
||||||
|
# debuggingEnabled: false
|
||||||
|
# devErrorsEnabled: false
|
||||||
|
node_env: production
|
||||||
|
# nodeProcessCountPerApplication: 1
|
||||||
|
# maxConcurrentRequestsPerProcess: 1024
|
||||||
|
# maxNamedPipeConnectionRetry: 24
|
||||||
|
# namedPipeConnectionRetryDelay: 250
|
||||||
|
# maxNamedPipeConnectionPoolSize: 512
|
||||||
|
# maxNamedPipePooledConnectionAge: 30000
|
||||||
|
# asyncCompletionThreadCount: 0
|
||||||
|
# initialRequestBufferSize: 4096
|
||||||
|
# maxRequestBufferSize: 65536
|
||||||
|
watchedFiles: iisnode.yml;node_modules\*;*.js
|
||||||
|
# uncFileChangesPollingInterval: 5000
|
||||||
|
# gracefulShutdownTimeout: 60000
|
||||||
|
# logDirectoryNameSuffix: logs
|
||||||
|
# debuggerPortRange: 5058-6058
|
||||||
|
# debuggerPathSegment: debug
|
||||||
|
# maxLogFileSizeInKB: 128
|
||||||
|
# appendToExistingLog: false
|
||||||
|
# logFileFlushInterval: 5000
|
||||||
|
# flushResponse: false
|
||||||
|
# enableXFF: false
|
||||||
|
# promoteServerVars:
|
29
package.json
Normal file
29
package.json
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"name": "node-echo",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "node-echo",
|
||||||
|
"main": "server.js",
|
||||||
|
"dependencies": {
|
||||||
|
"nodemon": "^1.0.19"
|
||||||
|
},
|
||||||
|
"engine": {
|
||||||
|
"node": "*",
|
||||||
|
"npm": "*"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "nodemon --ignore node_modules/ server.js"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/bettiolo/node-echo.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"Echo"
|
||||||
|
],
|
||||||
|
"author": "Marco Bettiolo <marco@bettiolo.it>",
|
||||||
|
"license": "",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/bettiolo/node-echo/issues"
|
||||||
|
},
|
||||||
|
"homepage": "http://apilb.com"
|
||||||
|
}
|
52
server.js
Normal file
52
server.js
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
var util = require('util');
|
||||||
|
var http = require('http');
|
||||||
|
var url = require('url');
|
||||||
|
var qs = require('querystring');
|
||||||
|
var os = require('os')
|
||||||
|
var port = process.env.PORT || process.env.port || 8000;
|
||||||
|
var nodeEnv = process.env.NODE_ENV || 'unknown';
|
||||||
|
var server = http.createServer(function (req, res) {
|
||||||
|
var url_parts = url.parse(req.url, true);
|
||||||
|
|
||||||
|
var body = '';
|
||||||
|
req.on('data', function (data) {
|
||||||
|
body += data;
|
||||||
|
});
|
||||||
|
req.on('end', function () {
|
||||||
|
var formattedBody = qs.parse(body);
|
||||||
|
|
||||||
|
res.writeHead(200, {'Content-Type': 'text/plain'});
|
||||||
|
|
||||||
|
res.write('This is a node.js echo service\n');
|
||||||
|
res.write('\n');
|
||||||
|
res.write('node.js Production Mode: ' + (nodeEnv == 'production' ? 'yes' : 'no') + '\n');
|
||||||
|
res.write('\n');
|
||||||
|
res.write('HTTP/' + req.httpVersion +'\n');
|
||||||
|
res.write('Request headers:\n');
|
||||||
|
res.write(util.inspect(req.headers, null) + '\n');
|
||||||
|
res.write('Request query:\n');
|
||||||
|
res.write(util.inspect(url_parts.query, null) + '\n');
|
||||||
|
res.write('Request body:\n');
|
||||||
|
res.write(util.inspect(formattedBody, null) + '\n');
|
||||||
|
res.write('\n');
|
||||||
|
res.write('Host: ' + os.hostname() + '\n');
|
||||||
|
res.write('OS Type: ' + os.type() + '\n');
|
||||||
|
res.write('OS Platform: ' + os.platform() + '\n');
|
||||||
|
res.write('OS Arch: ' + os.arch() + '\n');
|
||||||
|
res.write('OS Release: ' + os.release() + '\n');
|
||||||
|
res.write('OS Uptime: ' + os.uptime() + '\n');
|
||||||
|
res.write('OS Free memory: ' + os.freemem() / 1024 / 1024 + 'mb\n');
|
||||||
|
res.write('OS Total memory: ' + os.totalmem() / 1024 / 1024 + 'mb\n');
|
||||||
|
res.write('OS CPU count: ' + os.cpus().length + '\n');
|
||||||
|
res.write('OS CPU model: ' + os.cpus()[0].model + '\n');
|
||||||
|
res.write('OS CPU speed: ' + os.cpus()[0].speed + 'mhz\n');
|
||||||
|
res.write('\n');
|
||||||
|
process.env
|
||||||
|
res.write('Environment:\n');
|
||||||
|
res.write(util.inspect(process.env, null) + '\n');
|
||||||
|
res.end('\n');
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
server.listen(port);
|
||||||
|
console.log('Server running on port ' + port);
|
Loading…
Add table
Add a link
Reference in a new issue