Created
June 23, 2014 06:40
-
-
Save z-------------/07c8a2c01517b2f89df6 to your computer and use it in GitHub Desktop.
Simple node.js 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 express = require("express"); | |
| var app = express(); | |
| var http = require("http").Server(app); | |
| app.get("/", function(req, res) { | |
| res.sendfile(__dirname + "/index.html"); | |
| }); | |
| app.get(/^(.+)$/, function(req, res) { | |
| res.sendfile(__dirname + "/" + req.params[0]); | |
| }); | |
| http.listen(3000, function(){ | |
| console.log("listening on *:3000"); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment