Last active
October 2, 2016 22:57
-
-
Save mariyadiminsky/5cdf5049a5ced3e4e2706096069765d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var http = require('http'); // required for all steps. | |
// STEP #1 Basic server: | |
http.createServer(function(request,response) { | |
response.writeHead(200); // Tell the client if response is good. | |
response.write('My server worked!'); // the response body | |
response.end(); // end the connection. | |
}).listen(3000); // you can change this to another port if you want, but then you would have to visit that port in the browser too. | |
// STEP #1.5 Basic Server Continued... | |
//var bunnyServer = http.createServer(); | |
//bunnyServer.on('request', function(req, res) { | |
// res.writeHead(200); | |
// res.end('<html><body><h1>Bunny Server is live!<br /><img src="https://cdn.meme.am/instances/400x/55347780.jpg"></h1></body></html>'); | |
//}).listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment