Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@Funfun /Procfile
Last active Dec 24, 2015

Node.js HTTP streaming example (Event connection close doesn't work on heroku).
"name": "node-example",
"version": "0.0.1",
"dependencies": {
"express": "3.1.x",
"mongodb" : "1.1.11",
"redis-url": "0.1.0"
"engines": {
"node": "0.10.x",
"npm": "1.2.x"
web: node web.js
var express = require("express");
var app = express();
app.get('/', function(req, res) {
res.writeHead(200, {'Content-type': 'text/javascript'});
// code to handle connection abort
console.log("closed connection");
var interval = setInterval(function(){
res.write('Body data.\n');
console.log("Still processing a response.");
}, 1000);
var port = process.env.PORT || 5000;
app.listen(port, function() {
console.log("Listening on " + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.