mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 07:52:15 +00:00
nodejitsu: add mongo store back in
This commit is contained in:
parent
154e4822ea
commit
e49877190e
3 changed files with 22 additions and 8 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Generated by CoffeeScript 1.3.3
|
||||
var ONE_YEAR, app, derby, exports, express, expressApp, gzippo, http, path, publicPath, root, server, serverError;
|
||||
var MongoStore, ONE_YEAR, app, derby, exports, express, expressApp, gzippo, http, path, publicPath, root, server, serverError;
|
||||
|
||||
http = require('http');
|
||||
|
||||
|
|
@ -9,6 +9,8 @@ express = require('express');
|
|||
|
||||
gzippo = require('gzippo');
|
||||
|
||||
MongoStore = require('connect-mongo')(express);
|
||||
|
||||
derby = require('derby');
|
||||
|
||||
app = require('../app');
|
||||
|
|
@ -26,7 +28,11 @@ publicPath = path.join(root, 'public');
|
|||
})).use(express.compress()).use(express.cookieParser('secret_sauce')).use(express.session({
|
||||
cookie: {
|
||||
maxAge: ONE_YEAR
|
||||
}
|
||||
},
|
||||
store: new MongoStore({
|
||||
db: 'habitrpg',
|
||||
collection: 'express-sessions'
|
||||
})
|
||||
})).use(app.session()).use(app.router()).use(expressApp.router).use(serverError(root));
|
||||
|
||||
exports = module.exports = server = http.createServer(expressApp);
|
||||
|
|
@ -35,6 +41,12 @@ expressApp.all('*', function(req) {
|
|||
throw "404: " + req.url;
|
||||
});
|
||||
|
||||
derby.use(require('racer-db-mongo'));
|
||||
|
||||
exports.store = app.createStore({
|
||||
listen: server
|
||||
listen: server,
|
||||
db: {
|
||||
type: 'Mongo',
|
||||
uri: 'mongodb://localhost/habitrpg'
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
{
|
||||
"name": "habitrpg",
|
||||
"description": "",
|
||||
"version": "0.0.0-5",
|
||||
"version": "0.0.0-7",
|
||||
"main": "./server.js",
|
||||
"dependencies": {
|
||||
"derby": "*",
|
||||
"express": "3.x",
|
||||
"gzippo": ">=0.1.4",
|
||||
"racer-db-mongo": "*",
|
||||
"connect-mongo": ">=0.1.9",
|
||||
"derby-ui-boot": "*"
|
||||
},
|
||||
"private": true,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ http = require 'http'
|
|||
path = require 'path'
|
||||
express = require 'express'
|
||||
gzippo = require 'gzippo'
|
||||
# MongoStore = require('connect-mongo')(express)
|
||||
MongoStore = require('connect-mongo')(express)
|
||||
derby = require 'derby'
|
||||
app = require '../app'
|
||||
serverError = require './serverError'
|
||||
|
|
@ -30,7 +30,7 @@ publicPath = path.join root, 'public'
|
|||
.use(express.cookieParser 'secret_sauce')
|
||||
.use(express.session
|
||||
cookie: {maxAge: ONE_YEAR}
|
||||
# store: new MongoStore(db: 'habitrpg', collection: 'express-sessions')
|
||||
store: new MongoStore(db: 'habitrpg', collection: 'express-sessions')
|
||||
)
|
||||
.use(app.session())
|
||||
|
||||
|
|
@ -50,11 +50,11 @@ expressApp.all '*', (req) ->
|
|||
|
||||
## STORE SETUP ##
|
||||
|
||||
# derby.use(require 'racer-db-mongo')
|
||||
derby.use(require 'racer-db-mongo')
|
||||
|
||||
exports.store = app.createStore
|
||||
listen: server
|
||||
# db: {type: 'Mongo', uri: 'mongodb://localhost/habitrpg'}
|
||||
db: {type: 'Mongo', uri: 'mongodb://localhost/habitrpg'}
|
||||
|
||||
# Would implement cron here, using node-cron & https://github.com/codeparty/derby/issues/99#issuecomment-6596460
|
||||
# But it's not working
|
||||
|
|
|
|||
Loading…
Reference in a new issue