Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fist-fistlabs_unit_controller

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fist-fistlabs_unit_controller

Base controller as a unit

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

fist-fistlabs_unit_controller Build Status

Fist plugin providing abstract controller

##Basic usage:

//  app.js
var app = fist({
    unitSettings: {
        _fistlabs_unit_controller: {
            viewsDir: '/views',
            engines: {
                //   as module name
                '.jade': 'jade',
                // as consolidate signature function
                '.dust': require('consolidate').dust
            }
        }
    }
});
app.install('fist-fistlabs_unit_controller');
// fist_plugins/units/controllers/news.js
app.unit({
    base: '_fistlabs_unit_controller',
    name: 'news',
    rule: 'GET /news/',
    defaultName: 'index.jade',
    deps: ['user_info', 'news_list']
});

##Settings You can configure base controller unit with params.unitSettings

###String viewsDir=app.params.root+'views' The directory name view names will be resolved from

###Object engines={} The dictionary which provides extname->engine relation Supports extensions as bemhtml.js, in fact it is the substring from end of view file name. The value may be as string and consolidate.js template signature convention function

##API:

_fistlabs_unit_controller unit a also provides some api to make your controllers smarter.

###String unit.defaultViewName Default view name

###String unit.lookupViewName(track, context) Should return template name, returns unit.defaultViewName by default.

###Number unit.createResponseStatus(track, context) Should return response status code for current request. Returns 200 by default

###Object unit.createResponseHeader(track, context) Should create response header dictionary. Returns

{
    'Content-Type': 'text/html; charset="UTF-8"'
}

as default

###Object unit.createViewOpts(track, context) Should create an object which provides view options. See consolidate.js

###String unit.rule Router rule to automatic assign the unit with request pattern


LICENSE MIT

FAQs

Package last updated on 11 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc