Last active
August 29, 2015 14:01
-
-
Save davymacca/a96c3b3b88b842cf2c88 to your computer and use it in GitHub Desktop.
Really simple node server for serving static files.
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
| // A really simple node server for serving static files | |
| // | |
| // : To install | |
| // $ npm install express | |
| // $ npm install morgan | |
| // | |
| // | |
| // : To Run | |
| // node simple-server.js | |
| // put your static files in /public/ directory | |
| var express = require( 'express' ), | |
| morgan = require( 'morgan' ), | |
| server = express(), | |
| staticPath = __dirname + '/public/', | |
| port = 3000; | |
| server.use( morgan('dev') ); | |
| server.use( express.static(staticPath) ); | |
| server.listen( port ); | |
| console.log('Started Server on: http://localhost:' + port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your indentation is incorrect.