Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rousan committed Feb 28, 2018
2 parents 58e6366 + 0dcc21d commit 4c04745
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
extends: airbnb-base
rules:
no-console: off
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node src/app.js
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

The strange server implementation, you can't access the full response at once, `TRY IT IF YOU CAN 😁`.

## Demo

Look at this [demo](https://server-long-conn.herokuapp.com/).

## Usage

Clone it and start the server:
Expand Down
13 changes: 13 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "server-long-conn",
"description": "The strange server implementation whose full response can't be accessed at once",
"repository": "https://github.com/rousan/server-long-conn",
"keywords": [
"server",
"strange",
"nodejs",
"long",
"connection"
],
"image": "heroku/nodejs"
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server-long-conn",
"version": "1.0.0",
"version": "1.1.0",
"description": "The strange server implementation whose full response can't be accessed at once",
"main": "src/app.js",
"scripts": {
Expand All @@ -27,5 +27,8 @@
"eslint": "^4.18.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.9.0"
},
"engines": {
"node": "8.9.1"
}
}
5 changes: 4 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ const http = require('http');

const contentText = fs.readFileSync(path.join(__dirname, 'me.html'), { encoding: 'utf8' });
const interval = 0;
const PORT = process.env.PORT || 8080;

http.createServer((req, res) => {
console.log(`New connection on: ${req.connection.remoteAddress}`);

res.writeHead(200, { 'Content-Type': 'text/html' });

let i = 0;
Expand All @@ -19,4 +22,4 @@ http.createServer((req, res) => {
}
setTimeout(fn, interval);
}, interval);
}).listen(8080);
}).listen(PORT);

0 comments on commit 4c04745

Please sign in to comment.