Skip to content

Instantly share code, notes, and snippets.

@szimek
Created December 19, 2010 17:22
Show Gist options
  • Select an option

  • Save szimek/747494 to your computer and use it in GitHub Desktop.

Select an option

Save szimek/747494 to your computer and use it in GitHub Desktop.
Script for serving static pages in a directory
# Using Ruby with "rack" gem - run using "rackup"
use Rack::Static, :urls => [""]; run nil
// Using NodeJS with "express" module - run using "node webserver.js"
var sys = require("sys"),
connect = require("connect"),
express = require("express");
var port = 8080,
app = express.createServer();
app.configure(function () {
app.use(connect.staticProvider(__dirname + "/"));
});
app.listen(port);
sys.puts("Server running at http://0.0.0.0:" + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment