1.0.1 • Published 7 years ago

shack v1.0.1

Weekly downloads
9
License
MIT
Repository
github
Last release
7 years ago

An Express wrapper library that provides enhanced routing and controller handling.

Installation

$ npm install shack

Use just like express

var shack = require('shack');
var app = shack();

app.get('/', function(req, res){
  res.send('Hello World');
});

app.listen(3000);

Define routes in a dedicated JSON file

{
	"get /users": { "action":"users" },
	"post /users/:id": { "action":"users:update" },
	"put /users/:id": { "action":"users:create" }
}

Define controllers with actions instead of routes

var ctrl = require('shack').controller('users');

// A default "index" action is always created

ctrl.action('create', function(req, res, success) {
	// Save user
	User.save({}, function(user) {
		success(user);
	});
});

modules.exports = ctrl;

Features

  • Build on Express
  • Elegant, dedicated routing file
  • Controller pattern focused on actions instead of specifically http requests
  • Sensible defaults for common behaviors
  • Easily default whole controllers or actions to JSON
  • "before" and "after" handlers for common pre- or post-action behaviors
1.0.1

7 years ago

0.1.2

9 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago