Last active
August 29, 2015 14:00
-
-
Save kulicuu/11382415 to your computer and use it in GitHub Desktop.
essential elements of a SocketStream main app file that integrates Express within the Ss stack:
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
http= require 'http' | |
ss= require 'socketstream' | |
express= require 'express' | |
metro= express() | |
connectRedis= require 'connect-redis' | |
redisStore= connectRedis express | |
metro.use express.json() | |
metro.use express.bodyParser() | |
metro.use express.urlencoded() | |
metro.use express.static(__dirname + '/public') | |
metro.use express.cookieParser('someSecret') | |
metro.use express.session store: new redisStore(),secret: "someOtherSecret" | |
ss.session.store.use 'redis' | |
ss.publish.transport.use 'redis' | |
server= http.createServer metro | |
ss.start server | |
metro.stack= ss.http.middleware.stack.concat(metro.stack) | |
server.listen 3000 |
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
metro.get '/download', (req, res)-> | |
queryStuff= req.query.stuff | |
# do stuff | |
filename= "someFilename" | |
res.sendfile filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works with:
"express": "3.x",
and
"connect-redis": "1.4.7"