Skip to content

Commit

Permalink
persistent sessions, other stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidkahl committed Mar 3, 2012
1 parent 6399d12 commit 12b4112
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 12 deletions.
5 changes: 5 additions & 0 deletions config.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
config = {}
config.port = 5984
config.host = 'arvidkahl.iriscouch.com'
config.name = 'sessions'
module.exports = config
16 changes: 8 additions & 8 deletions main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ less = require 'less'
fs = require 'fs'
md = require('node-markdown').Markdown
auth = require 'auth'
config = require 'config'

#session perstistence
connectCouchDB = require('connect-couchdb')(exp)

#auth.helpExpress app

# App Configuration
Expand All @@ -17,18 +22,13 @@ app.configure () ->
app.use exp.methodOverride()
app.use exp.bodyParser()
app.use exp.cookieParser()
app.use exp.session {secret: 'nawollenwirdochmalsehn'}
app.use exp.static __dirname + '/public'
#app.use '/public/less' exp.static(__dirname + '/public/less')

app.use exp.session {secret: 'nawollenwirdochmalsehn', store: new connectCouchDB({host: config.host,name: 'sessions', reapInterval: 600000, compactInterval: 300000})}
app.use exp.static __dirname + '/public'
app.use auth.middleware()

#exp.compiler.compilers.less.compile = (str, fn) =>
# less.render str, { compress : true }, fn

# Articler Class
Articler = require('./articler').Articler
article = new Articler 'http://arvidkahl.iriscouch.com', 5984
article = new Articler config.host, config.port

app.get '/', (req, res) ->
if (req.session.auth)
Expand Down
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name" : "spark",
"description" : "picturing ideas",
"url" : "http://spark.nodester.com",
"keywords" : ["conceptart", "images", "stories", "fiction"],
"author" : "Arvid Kahl <[email protected]>",
"contributors" : [],
"version" : "0.1.0",
"directories" : { "public": "./public" },
"engines" : { "node": ">=0.2.0" },
"dependencies":{
"coffee-script":"*",
"express":"*",
"jade":"*",
"everyauth":"*",
"couchdb":"*",
"node-markdown":"*",
"connect-couchdb":"*",
"less":"*",
"cradle":"*"
}
}
3 changes: 3 additions & 0 deletions public/less/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -3683,3 +3683,6 @@ a.thumbnail:hover {
body {
padding-top: 60px;
}
h1 {
color: green;
}
4 changes: 4 additions & 0 deletions public/less/utilities.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
body {
padding-top: 60px;
}

h1 {
color:blue;
}
18 changes: 14 additions & 4 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ div.container
div.span10
- each article in articles
.article
h1= article.title
h2= article.title
span.created= article.created_at
span.body= article.body
div.span2
h3 Secondary content
footer
p &copy; Company 2011


p &copy;
a(href= "http://www.arvidkahl.de")="Arvid Kahl"
| . Website is built with
a(href= "http://nodejs.org")= "Node.js"
|,
a(href= "http://www.http://expressjs.com")="Express"
|,
a(href= "http://couchdb.apache.org/")="CouchDB"
|,
a(href= "http://lesscss.org/")="LESS"
| and
a(href= "http://coffeescript.org/")="Coffee-Script"
|.

0 comments on commit 12b4112

Please sign in to comment.