Skip to content

Instantly share code, notes, and snippets.

@jaketrent
Last active August 29, 2015 14:07
Show Gist options
  • Save jaketrent/899f83b62f35f43b7ae7 to your computer and use it in GitHub Desktop.
Save jaketrent/899f83b62f35f43b7ae7 to your computer and use it in GitHub Desktop.
Most-Vanilla Node Server
<html>
<head>
<script src="http://code.jquery.com/jquery.js"></script>
<script>
$(function() {
$.get('http://localhost:3000')
});
</script>
</head>
</html>
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