1.0.3 • Published 8 years ago

sails-hook-routefactory v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

sails-hook-routefactory

Build Status codecov.io

A sailsjs hook that allows a function under sails.config.routefactory to behave like laravel's routing engine.

Installation

Installing custom hooks for a sailsjs application is done by installing their npm module as a dependency of the application. Sails picks up these special packages by looking for those modules having a sails.isHook property set to true. So, to start using this hook, just run

npm i sails-hook-routefactory --save

Useage

The hook uses the sails.config.routefactory property, which can be set by creating a file underneath your application's config directory called routefactory.js. This file should look like this:

module.exports.routefactory = function(factory) {

  factory.resource('user', 'UserController');

  factory.group('admin', function() {
    factory.get('/info', 'SystemController.diagnostics');

    factory.resource('/settings', 'SystemController', {except: ['findOne', 'destroy']});
  });

  factory.route('POST /logger', 'LoggerController.create');

};
1.0.3

8 years ago

0.0.1

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago