Skip to content

Instantly share code, notes, and snippets.

@mulderp mulderp/gist:9740253
Created Mar 24, 2014

Embed
What would you like to do?
serverbone test
global.serverbone = require("serverbone");
global.BaseModel = serverbone.models.BaseModel;
global.redis = require("redis");
global.RedisDb = require('backbone-db-redis');
global.store = new RedisDb('mymodel', redis.createClient());
global.movieSchema = {
id: 'schemas/movies',
type: 'object',
properties: {
title: {
type: 'string'
},
length: {
type: 'integer'
}
// genres --> Array ?
},
indexes: [{
property: 'title'
}]
};
global.MovieModel = BaseModel.extend({
type: 'moviesmodel',
schema: movieSchema,
sync: RedisDb.sync.bind(redis),
db: redis,
url: function() {
var key = this.dbBaseKey || this.type;
if (this.isNew()) {
return key;
} else {
return key + ':' + this.get(this.idAttribute);
}
}
});
var repl = require("repl").start({ useGlobal: true, ignoreUndefined: false })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.