Last active
August 29, 2015 13:56
-
-
Save dbehnke/9003473 to your computer and use it in GitHub Desktop.
create a simple static web server for development with node.js
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
/* | |
Simple test webserver for static content - the docs are bigger than the code! | |
1. install node and npm: http://nodejs.org/ | |
2. create a directory where you want your little web server | |
3. cd to that directory | |
4. save this file you are reading to that directory as app.js | |
5. npm install express | |
6. mkdir public | |
7. put your static content in public | |
8. run the server: node app.js | |
9. open http://localhost:3000/local/yourwebpage.html in browser | |
*/ | |
var express = require('express'); | |
var app = express(); | |
app.use(express.static(__dirname + '/public')); | |
app.listen(process.env.PORT || 3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment