mio-express

Expose Mio models via RESTful resource middleware.

npm install mio-express
6 downloads in the last week
11 downloads in the last month

mio-express

Build Status Dependency Status Coverage Status

Expose Mio models via RESTful resource middleware.

This module can be paired with mio-ajax for automatic client-server communication.

Installation

npm install mio-express

Example

Use with express:

var express = require('express')
  , mio = require('mio');

var User = mio.createModel('User');

User
  .attr('id')
  .attr('name')
  .use('server', 'mio-express');

var app = express();

app
  .use(express.bodyParser())
  .get('/users', User.middleware.index)
  .post('/users', User.middleware.create)
  .get('/users/:id', User.middleware.show)
  .put('/users/:id', User.middleware.update)
  .del('/users/:id', User.middleware.destroy);

Use with express-resource:

app.resource('users', User.middleware);

MIT Licensed

npm loves you