JSPM

  • Created
  • Published
  • Downloads 41
  • Score
    100M100P100Q86274F

Customizable CMS platform

Package Exports

  • periodicjs.core.controller

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (periodicjs.core.controller) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

periodicjs.core.controller

Periodic's Core Controller module, provides helpful controller methods for querying documents and rendering responses.

Extensions are node modules that are loaded when an instance of periodic is instantiated.

API Documentation

Installation

$ npm install periodicjs.core.controller

This is a part of Periodic's core.

Usage

Querying for tag

JavaScript

var Controller = require('periodicjs.core.controller'),
    CoreController = new ControllerHelper(resources),
    Tag = mongoose.model('Tag');
req.controllerData = (req.controllerData) ? req.controllerData : {};

CoreController.loadModel({
        docid: 'news',
        model: Tag,
        population: 'contenttypes parent',
        callback: function (err, doc) {
            if (err) {
                CoreController.handleDocumentQueryErrorResponse({
                    err: err,
                    res: res,
                    req: req
                });
            }
            else {
                req.controllerData.tag = doc;
                next();
            }
        }
    });

##Development Make sure you have grunt installed

$ npm install -g grunt-cli

Then run grunt watch

$ grunt watch

##Notes