Skip to content

Instantly share code, notes, and snippets.

@bnoguchi
Created March 11, 2012 20:42
Show Gist options
  • Save bnoguchi/2018148 to your computer and use it in GitHub Desktop.
Save bnoguchi/2018148 to your computer and use it in GitHub Desktop.
EveryAuth issue #208 (CoffeeScript)
bootstrapAuthentication()
application = express.createServer()
application.configure ->
bootstrap(application)
application.listen(2536)
bootstrapAuthentication = () ->
everyauth.twitter
.consumerKey(myConsumerKey)
.consumerSecret(myConsumerSecret)
.findOrCreateUser(
(session, accessToken, accessTokenSecret, twitterUser) ->
console.log twitterUserData
console.log accessToken
console.log accessTokenSecret
return twitterUser
)
.redirectPath('/')
bootstrap = (application) ->
bootstrapExpress(application)
bootstrapRoutes(application)
bootstrapCouchDB()
bootstrapExpress = (application) ->
application.use(express.bodyParser())
application.use(express.methodOverride())
application.use(express.cookieParser())
application.use(express.session( secret: '54df54df151df' ))
application.use(everyauth.middleware())
application.use(application.router)
application.use(express.static(__dirname + '/public'))
application.use(express.errorHandler())
everyauth.helpExpress(application)
application.helpers(viewHelpers)
application.set('view engine', 'jade')
application.set('showStackTrace', application.settings.env == 'development')
bootstrapRoutes = (application) ->
application.get('/', routes.index)
bootstrapCouchDB = ->
# Bootstrapping cradle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment