sutro

Web framework for node.js using generators for flow-control (and happiness). Sutro is a fast, flexible koa middleware stack for building awesome web applications and REST APIs.

npm install sutro
4 downloads in the last week
18 downloads in the last month

Sutro

Web framework for node.js using generators for flow-control (and happiness).

Sutro is a fast, flexible koa middleware stack for building awesome web applications and REST APIs.

  • Use generators for flow-control.
  • Modular. Add your own middleware.
  • RESTful Rails-like resource routing.
  • Multi-dialect ORM (MongoDB, MySQL, Postgres) with validation, associations, and migrations.
var app = require('sutro')();

app.get('/users/:id', function *(id) {
  var user = yield User.findOne(id);
  this.body = user;
});

Generators for flow-control

Sutro uses ES6 generators via co for flow-control. This allows you to write non-blocking code without callbacks using the yield keyword.

Read Callbacks vs Coroutines for an overview of using generators for flow-control.

Installation

Sutro is available using npm:

npm install --global sutro

To use Sutro you must be running node 0.11.4 or higher for generators support, and must run node with the --harmony-generators switch. We recommend adding an alias to your shell profile:

alias node='node --harmony-generators'

Quick Start

Use the sutro(1) executable to generate a project skeleton as shown below:

$ sutro new my-project && cd my-project

Install dependencies:

$ npm install

Start the server:

$ sutro start

Visit http://localhost:4001 in your browser and you should see the Sutro documentation.

More Information

  • Join #sutrojs on freenode
  • Follow @alexmingoia on twitter for updates.
  • Visit the Wiki.

Tests

Tests are written with mocha and run using npm:

npm test

Special thanks

Special thanks to TJ Holowaychuk for koa, co and Anatoliy Chakkaev for jugglingdb. Sutro is built upon their work.

MIT Licensed

Copyright (c) 2013 Alexander C. Mingoia

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

npm loves you