Last active
June 6, 2016 21:54
-
-
Save JuanMaRuiz/363d5065b8c78f6479de5eae700ec7f0 to your computer and use it in GitHub Desktop.
How to initialize a simple node server with express.
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
/* 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