Last active
December 19, 2015 20:59
-
-
Save watert/6017215 to your computer and use it in GitHub Desktop.
Basic server based on coffee-script & express & underscore
This file contains 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
###== Basic server based on coffee-script & express == | |
# run by forever: | |
sudo forever -w -c coffee server.coffee | |
### | |
_ = require("underscore")._ | |
express = require "express" | |
app = express() | |
console.log "\n--- BEGIN --- @ " + new Date() | |
### Config Part ### | |
publicDir = __dirname + '/public' | |
app.use(express.static(publicDir)) | |
app.use(express.bodyParser()) | |
app.use(express.cookieParser()) | |
app.use(express.session( secret:"watert's links" )) | |
### Views Part ### | |
app.set('views', __dirname + '/views') | |
app.set('view engine', 'jade') | |
app.set('view options', { layout: false }) | |
app.set('view cache', false ) | |
ejs = _.extend require('ejs'),open:"{{",close:"}}" | |
app.engine('.html', ejs.renderFile) | |
app.port = 3001 | |
console.log "Start Listening to "+app.port | |
app.listen app.port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment