https://github.com/stevenmhunt/rendr-controller-factory
Provides a clean and simple way of building Rendr controllers, and minimizes boilerplate code.
https://github.com/stevenmhunt/rendr-controller-factory
Last synced: 4 months ago
JSON representation
Provides a clean and simple way of building Rendr controllers, and minimizes boilerplate code.
- Host: GitHub
- URL: https://github.com/stevenmhunt/rendr-controller-factory
- Owner: stevenmhunt
- License: mit
- Created: 2014-06-07T03:07:36.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-07T03:59:35.000Z (about 11 years ago)
- Last Synced: 2025-01-18T00:27:03.387Z (6 months ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rendr-controller-factory
========================Provides a clean and simple way of building Rendr controllers, and minimizes boilerplate code.
Installation (Coming Soon!)
------------`npm install rendr-controller-factory`
Usage
-----At the top of your controller file, start by creating a controller.
```
var controller = require('rendr-controller-factory')(module);
```Notice how we pass the current file's module object? that's how controller factory knows what your controller is supposed to be called according to Rendr.
Next, register actions to the controller:
```
controller.action('index', function (params, callback) {// Yes, the controller factory keeps the correct context around...
var app = this.app;});
```At the end of the file, finish your controller by building it.
```
controller.build();
```Since the controller factory already has a reference to the module object, it handles the export registration.