Last active
August 29, 2015 14:07
-
-
Save jaketrent/899f83b62f35f43b7ae7 to your computer and use it in GitHub Desktop.
Most-Vanilla Node Server
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
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery.js"></script> | |
<script> | |
$(function() { | |
$.get('http://localhost:3000') | |
}); | |
</script> | |
</head> | |
</html> |
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
var onRequest = function(req, res) { | |
res.writeHead(200, { | |
'Connection': 'close', | |
'Content-Type': 'text/html' | |
}); | |
res.end('<h1>Hello world</h1>'); | |
} | |
http = require('http'); | |
http.createServer(onRequest).listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment