Skip to content

Instantly share code, notes, and snippets.

@JuanMaRuiz
Last active June 6, 2016 21:54
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 JuanMaRuiz/363d5065b8c78f6479de5eae700ec7f0 to your computer and use it in GitHub Desktop.
Save JuanMaRuiz/363d5065b8c78f6479de5eae700ec7f0 to your computer and use it in GitHub Desktop.
How to initialize a simple node server with express.
/* First all you need too install express as a dependency
* $ npm i express --save
* For more information about express visit http://expressjs.com/
*/
var express = require('express');
var app = express();
// __dirname + '/' refers to the folder you have created index.html
app.use('/', express.static(__dirname + '/'));
// Define the port your server is listening
app.listen('3000', function(){
console.log('Server running in http://localhost:3000');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment