Skip to content

Commit

Permalink
initial commit for simple node.js server
Browse files Browse the repository at this point in the history
  • Loading branch information
timfpark committed Oct 15, 2014
0 parents commit f891f8d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Tim Park

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# simple-nodejs-server

Incredibly simple node.js server that prints out the number of milliseconds since it was started.

Useful for demonstrating node.js app deployment and other things where it's not about the app.
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "simple-nodejs-server",
"homepage": "https://github.com/timfpark/simple-nodejs-server",
"repository": {
"type": "git",
"url": "https://github.com/tmifpark/simple-nodejs-server.git"
},
"author": "Tim Park <timfpark@gmail.com>",
"version": "0.1.0",
"licenses": [
{
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
],
"engines": {
"node": "0.10.24"
},
"dependencies": {
}
}
12 changes: 12 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var http = require('http');

var startTime = new Date();

var server = http.createServer(function(req, res){
// for any request, print out the number of milliseconds since the server started.

var elapsedTime = new Date().getTime() - startTime.getTime();
res.end(elapsedTime.toString());
});

server.listen(8000);

0 comments on commit f891f8d

Please sign in to comment.