Last active
January 13, 2018 18:52
-
-
Save kevinchisholm/742b6e47add92d4e64b893414ca8f939 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//require the express nodejs module | |
var express = require('express'), | |
//set an instance of exress | |
app = express(); | |
//tell express what to do when the / route is requested | |
app.get('/', function (req, res) { | |
var i = 1, | |
max = 5; | |
//set the appropriate HTTP header | |
res.setHeader('Content-Type', 'text/html'); | |
//send multiple responses to the client | |
for (; i <= max; i++) { | |
res.send('<h1>This is the response #: ' + i + '</h1>'); | |
} | |
}); | |
//wait for a connection | |
app.listen(5000, function () { | |
console.log('The web server is running. Please open http://localhost:5000/ in your browser.'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//require the express nodejs module | |
var express = require('express'), | |
//set an instance of exress | |
app = express(); | |
//tell express what to do when the / route is requested | |
app.get('/', function (req, res) { | |
var i = 1, | |
max = 5; | |
//set the appropriate HTTP header | |
res.setHeader('Content-Type', 'text/html'); | |
//send multiple responses to the client | |
for (; i <= max; i++) { | |
res.write('<h1>This is the response #: ' + i + '</h1>'); | |
} | |
}); | |
//wait for a connection | |
app.listen(5000, function () { | |
console.log('The web server is running. Please open http://localhost:5000/ in your browser.'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//require the express nodejs module | |
var express = require('express'), | |
//set an instance of exress | |
app = express(); | |
//tell express what to do when the / route is requested | |
app.get('/', function (req, res) { | |
var i = 1, | |
max = 5; | |
//set the appropriate HTTP header | |
res.setHeader('Content-Type', 'text/html'); | |
//send multiple responses to the client | |
for (; i <= max; i++) { | |
res.write('<h1>This is the response #: ' + i + '</h1>'); | |
} | |
//end the response process | |
res.end(); | |
}); | |
//wait for a connection | |
app.listen(5000, function () { | |
console.log('The web server is running. Please open http://localhost:5000/ in your browser.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment