Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
CoffeeScript
tree: 060715e5f6

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/rithis-stack
.gitignore
LICENSE
README.md
package.json

README.md

Our web stack: express, mongoose, rithis-crud

Example usage

rithis = require "rithis-stack"


rithis.configure __dirname, "example-app", (stack, callback) ->
    # schemas
    DocumentSchema = new stack.mongoose.Schema
        name: type: "string", required: true
        date: type: "date", required: true

    # models
    Document = stack.connection.model "documents", DocumentSchema

    # routes
    app.get "/documents", stack.crud
        .list(Document)
        .sort("-date")
        .make()

    app.post "/documents", stack.crud
        .post(Document)
        .make()

    # done
    callback()

You can define your own stack:

rithis = require "rithis-stack"

stack = new rithis.Stack __dirname, "example-app"

stack.app.configure ->
    stack.app.use express.logger()
    stack.app.use express.bodyParser()

stack.app.configure "development", ->
    stack.app.use express.errorHandler()

stack.plugins.push plugins.crud
stack.plugins.push plugins.mongoose

stack.plugins.push (stack, callback) ->
    # schemas
    DocumentSchema = new stack.mongoose.Schema
        name: type: "string", required: true
        date: type: "date", required: true

    # models
    Document = stack.connection.model "documents", DocumentSchema

    # routes
    app.get "/documents", stack.crud
        .list(Document)
        .sort("-date")
        .make()

    app.post "/documents", stack.crud
        .post(Document)
        .make()

    # done
    callback()
Something went wrong with that request. Please try again.