Skip to content

Commit 3c5756c

Browse files
committed
Node.js Server
1 parent de1a2d7 commit 3c5756c

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

nodejs-server/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Running a Node.js Server Forever
2+
3+
> [http://youtu.be/P4mT5Tbx_KE](http://youtu.be/P4mT5Tbx_KE)
4+
5+
Install [io.js](https://iojs.org/en/index.html).
6+
7+
Then run `node server.js` to run the app.

nodejs-server/package.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "nodejs-server",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "budo index.js",
8+
"test": "node test.js"
9+
},
10+
"author": "Kyle Robinson Young <[email protected]> (http://dontkry.com)",
11+
"license": "MIT"
12+
}

nodejs-server/server.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var http = require('http');
2+
3+
var server = http.createServer(function (request, response) {
4+
if (request.url === '/') {
5+
response.setHeader('Content-Type', 'text/html');
6+
response.end('<strong>obligatory bear!</strong>');
7+
}
8+
});
9+
10+
server.listen(8080, function () {
11+
console.log('Im listening on port 8080');
12+
});

0 commit comments

Comments
 (0)