0.2.0 • Published 10 years ago

regio v0.2.0

Weekly downloads
10
License
MIT
Repository
github
Last release
10 years ago

regio

Minimalist web framework with express-like aspirations, targeted at embedded devices like Tessel and Espruino. Therefore, instead being a mighty express it is just a regional train...

Build Status Code Climate

Motivation

So why another framework?

This framework started as a test suite while investigating how to get express running on Tessel.

Because there were simply too many moving parts in slimming down express, I've decided to start with a clean slate and incorporate express middlewares one at a time.

In the process I found out that there is quite a lot of stuff to handle pre 4.x API, disambiguation of function parameters and also too many convenience methods for such a constrained environment as on the devices I was targeting.

So, I've decided to keep the test framework around and use express middleware and components where it does feel appropriate, especially as Espruino is also a target environment.

Installation

npm install regio

Usage

var regio = require('regio');

var app = regio();

app.get('/', function(req, res) {
  res.status(200).send({
    message: 'Hello World'
  }).end();
});

app.use(function (req, res, next) {
  req.message = 'added by middleware';
  next();
});

var subapp = regio.router();

subapp.get('/', function(req, res) {
  res.status(200).send({
    message: 'I\'m a mounted application'
  }).end();
});

subapp.on('active', function() {
  // server is up, I can receive requests
});

app.use('/mounted', subapp);

var server = app.listen(8080, function() {
  console.log('app started on port', server.address().port);
});

Express compatibility

Middleware

  • can be used application and router level, using .use or .verb.

Tests

Currently the test run in node but the plan is to move them to colony.

npm test
0.2.0

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago