socketstream-resource

0.0.4 • Public • Published

SocketStream Resource

A library to simplify adding CRUD to your SocketStream applications. Currently supports MongoDB through Mongoose.

Install

npm install socketstream-resource

Usage

Say you've got a config/db.coffee file that looks like this:

global.mongoose = require 'mongoose'
mongoose.connect "mongodb://localhost/socketstream_resource_test"
global.Schema   = mongoose.Schema
global.ObjectId = Schema.ObjectId
global.Products = new Schema 
  name: String
global.Product = mongoose.model 'Product'Products

Create a file named app/server/realm.coffee, and provide the following line:

resource        = require 'socketstream-resource'
exports.actions = resource.add Product

This now gives the SS.server.realm object the following actions:

  • get
  • getById
  • create
  • update
  • remove

I'm going to provide some nice-looking API documentation for this later, but for now, I advise you to take a peek at the spec/api.spec.coffee file to see how it's used, and what you can expect to get back.

/socketstream-resource/

    Package Sidebar

    Install

    npm i socketstream-resource

    Weekly Downloads

    2

    Version

    0.0.4

    License

    none

    Last publish

    Collaborators

    • paulbjensen