How to use the wilson/shortcuts.renderToResponse function in wilson

To help you get started, we’ve selected a few wilson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chrisdickinson / wilson / lib / core / codetemplates / app / views.js View on Github external
var shortcuts = require('wilson/shortcuts'),
    renderToResponse = shortcuts.renderToResponse,
    getObjectOr404 = shortcuts.getObjectOr404;

// write your views here
github chrisdickinson / wilson / lib / core / middleware.js View on Github external
var http = require('wilson/http'),
    urls = require('wilson/urls'),
    escaperoute = require('escaperoute'),
    shortcuts = require('wilson/shortcuts'),
    renderToResponse = shortcuts.renderToResponse,
    qs = require('querystring');

exports.BaseMiddleware = {
    'processRequest':function(req) {
        var rootUrlConf = urls.getRoot(),
            match = rootUrlConf.match(req.pathname);
        req.request_middleware.push({'processRequest':function (req) {
            match(req);
        }});
        req.attemptContinue();
    },
    'processException':function(req) {
        var error = null;
        try {
            error = req.errors.shift();
        } catch(err) {
github chrisdickinson / wilson / lib / contrib / auth / views.js View on Github external
var shortcuts = require('wilson/shortcuts'),
    http = require('wilson/http'),
    utils = require('wilson/contrib/auth/utils'),
    renderToResponse = shortcuts.renderToResponse,
    getObjectOr404 = shortcuts.getObjectOr404;

exports.login = function(request, kwargs) {
    kwargs = kwargs || {};

    var self = this,
        defaults = {
            redirect_key:'next',
            auth_form:'auth/login.html',
        };

    Object.keys(defaults).forEach(function(key) {
        kwargs[key] = kwargs[key] || defaults[key];
    });

    if(request.method == 'POST') {