Flatiron

nodejs-frameworks

Articles

http://flatironjs.org/

What is Flatiron?

Flatiron (GitHub: flatiron / flatiron, License: MIT, npm: flatiron) from Nodejitsu is a full-stack framework but it’s actually very loosely coupled. Each library in the framework can be used in isolation, and it’s entirely possible to cherry pick parts of it.

Can we cherry pick the various parts of Flatiron?

Yes. Each library in the framework can be used in isolation, and it’s entirely possible to cherry pick parts of it.

What are the libraries that make up Flatiron?

The libraries that make up Flatiron are as follows:

What are the main features provided by Flatiron?

This is still not clear to me compared to other frameworks.

How does the routing library work?

The routing library, Director, works in both browsers and Node with no external dependencies. Objects are used to represent the relationship between URLs and methods. Union, the routing middleware, is simple but compatible with Connect middleware.

How does the Plates templating engine work?

Plates also works in browsers and Node, but it’s slightly different to other template libraries. All templates are actually valid HTML, with no special characters for value insertion. The relationship between tags and values is defined through object literals that are passed to Plates.bind:

Plates.bind(
  // The first parameter is the HTML template
  '<span></span><img id="bar" class="foo bazz" src=""/>',

  // The second parameter is key/value pairs of data
  { 'bazz': 'Hello, World' },

  // The third parameter defines how values map to tags
  { 'bazz': ['class', 'src'] }
);

What does ODM abbreviate for?

Object-Document Mapper. What’s nice about this library is it uses simple prototype objects. Properties can be defined and validated. It also has a chainable property definition API:

var resourceful = require('resourceful')
  , Creature = resourceful.define('creature');

Creature.property('legs', Number)
  .required()
  .minimum(0)
  .maximum(8)
  .assert(function (val) { return val % 2 === 0 });

What databases are used or supported?

Judging by the source, only CouchDB is supported right now, but like Racer this library has been designed with a view to adding support for more databases in the future.

What is the purpose of the Broadway library?

The Broadway library provides a simple base for application-like objects that can be extended through plugins. Each app inherits from EventEmitter2.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License