Created
January 25, 2017 14:38
-
-
Save jonathanargentiero/451f28e969b7bd310a6f6de5157bb1e9 to your computer and use it in GitHub Desktop.
Quick Node.JS static server
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
| var connect = require('connect'); | |
| var serveStatic = require('serve-static'); | |
| connect().use(serveStatic(__dirname)).listen(8080, function(){ | |
| console.log('Server running on 8080...'); | |
| }); | |
| /** package.json | |
| { | |
| "name": "myApp", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "server.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "start": "node server.js" | |
| }, | |
| "author": "", | |
| "license": "ISC", | |
| "dependencies": { | |
| "connect": "^3.5.0", | |
| "serve-static": "^1.11.1" | |
| } | |
| } | |
| **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment