Skip to content

Instantly share code, notes, and snippets.

@infomaven
Last active March 19, 2017 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infomaven/b42b4626684521833a1e33119ddc796c to your computer and use it in GitHub Desktop.
Save infomaven/b42b4626684521833a1e33119ddc796c to your computer and use it in GitHub Desktop.
Technical questions
What is the difference between "express": "^4.13.3" and "express": "~4.13.3" ?
What happens if I use `npm install <package> --save` instead of `npm install <package> --save-dev` ?
var http = require('http');
var hostname = 'localhost';
var port = 3000;
var server = http.createServer( function(req, res) {
console.log( req.headers);
res.writeHead( 200, { 'Content-Type': 'text/html' });
res.end( '<html><body><h1>Hello World</h1></body></html>');
})
server.listen( port, hostname, function() {
/* TQ: what will each of these lines yield as output? */
console.log( `Server running at http://${hostname}:${port}/`);
console.log( 'Server running at http://${hostname}:${port}/');
console.log( "Server running at http://${hostname}:${port}/");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment