Skip to content

Commit

Permalink
Easy deployment to now.sh (#26)
Browse files Browse the repository at this point in the history
* Add an npm start script

* Add `now.sh` deployment instructions

* Fix: Add HTTP header to prevent NGINX from breaking server sent events.
  • Loading branch information
billiegoose authored and mafintosh committed Sep 28, 2017
1 parent d98ffb0 commit 1289b76
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,17 @@ signalhub subscribe my-app my-channel -p 8080 -h yourhub.com

This also works in the browser using browserify :)

## Heroku
## Deploying with popular services

No additional configuration is needed.

### now.sh

```
now mafintosh/signalhub
```

### Heroku
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)

## License
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"tape": "^4.0.0"
},
"scripts": {
"start": "node ./bin.js listen",
"test": "standard && tape test.js"
},
"bin": {
Expand Down
3 changes: 3 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ module.exports = function (opts) {

if (req.method === 'GET') {
res.setHeader('Content-Type', 'text/event-stream; charset=utf-8')
res.setHeader('Cache-Control', 'no-cache')
// Disable NGINX request buffering
res.setHeader('X-Accel-Buffering', 'no')

var app = name.split('/')[0]
var channelNames = name.slice(app.length + 1)
Expand Down

0 comments on commit 1289b76

Please sign in to comment.