Created
January 26, 2013 07:57
-
-
Save katoy/4640902 to your computer and use it in GitHub Desktop.
Samples using lactate.
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
actate = require 'lactate' | |
express = require 'express' | |
root_dir = __dirname | |
port = 8080 | |
options = debug: true | |
app = express() | |
app.use lactate.static(root_dir) | |
app.use express.directory(root_dir) | |
app.listen port | |
console.log "Listening on port #{port}" |
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
actate = require 'lactate' | |
express = require 'express' | |
root_dir = __dirname # process.cwd() | |
port = 8080 | |
options = | |
root: root_dir | |
from: "" | |
subdirs: true | |
autoindex: true | |
bundle: true | |
cache: true | |
debug: true | |
files = lactate.dir(root_dir, options).toMiddleware() | |
app = express() | |
app.use files | |
# app.get('/*', files); | |
app.listen port | |
console.log "Listening on port #{port}" | |
# It is not works for directory-index. Why? |
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
lactate = require 'lactate' | |
http = require 'http' | |
port = 8080 | |
# var root_dir = "/Users/youichikato/github/zzz"; | |
root_dir = "./" | |
options = | |
root: root_dir | |
from: "" | |
subdirs: true | |
autoindex: true | |
debug: true | |
files = lactate.dir(root_dir, options) | |
server = new http.Server | |
server.addListener "request", (req, res) -> | |
files.serve req, res | |
server.listen port | |
console.log "Listening on port #{port}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment