Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8317999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:48:12+00:00 2026-06-08T21:48:12+00:00

Here is my code: var express = require(‘express’), app = express.createServer(express.logger()); app.use(express.bodyParser()); app.get(‘/’, function(request,

  • 0

Here is my code:

var express = require('express'),
      app = express.createServer(express.logger());
app.use(express.bodyParser());
app.get('/', function(request, response) {
    var name = request.param('name', null);
    response.header('Content-Type', 'text/event-stream');
    var t = setInterval(function(){
        response.write('Hello World by '+name+' (using http-1.1 streaming data!)<br />');
    }, 2000);
    /*request.socket.on('close', function() {
        clearInterval(t);
    }); */
});

var port = process.env.PORT || 5000;
app.listen(port, function() {
    //clearInterval(t);

  console.log("Listening on " + port);
});

I am using express because I am testing this in heroku and I used the guide there.
So when I open the app I get a download popup with the data in the file (downloaded) instead of the html (dom) response.

What did I do wrong? (is it a browser problem?)

Edit:
@Joe, has solved my initial problem but yet, I have two questions:
1) Why i don’t need to insert a ‘correct’ content type? (of streaming?)
2) Why does this code out put only after along time (about half a minute).?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:48:14+00:00Added an answer on June 8, 2026 at 9:48 pm

    If you are trying to display it as HTML you will want your Content-Type to be text/html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Node.js code: var express = require('express'); var app = express.createServer(express.logger());
Here's an extension of the sample node.js code: var express = require('express'); var application
Here is my code: var showNo = 1; window.setInterval(function() { console.log(showNo); if(showNo === 1)
Here is some code: var class = function(elem,div){ this.elem= elem; this.div = div; this.init
I have this code here: var Person = (function() { var name; var PersonConstructor
Here is my chunk of code: var update_shipping_methods = function(methods) { $(methods).each( function(i) {
I have here is an example directly got from express document. app.use(express.cookieParser()); app.use(express.session({ secret:
I am trying to render partials using node.js. Here is my code. app.js: var
I check like this: enter code here var point = new g.LatLng(parseFloat(lat),parseFloat(lng)); var bounds
I've been here and accordingly found out that this piece of code here var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.