Last active
December 19, 2015 22:29
-
-
Save realyze/6027692 to your computer and use it in GitHub Desktop.
Adding cookie to allow client authentication.
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
express = require 'express' | |
config = require 'config' | |
app = express() | |
app.configure -> | |
app.use '/static/', express.static config.static_root path.join __dirname, '/../client/build' | |
app.use '/static/', (req, res, next) -> | |
# We're requesting a non-existent static resource. | |
res.send 404 | |
# Your routes... | |
# Default route. | |
app.get '/*', (req, res) -> | |
res.cookie 'user', JSON.stringify(req.user?.doc) or null | |
res.render 'index.html' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment