04-proxy.js 420 Bytes
//代理RESTful API
var express = require('express');
exports = module.exports = function (settings, proxy) {

    var app = this;
    var router = express.Router();
    if (settings.proxy) {
        app.use(settings.proxy.apiRouteRegexp, router);
        router.all('*', function (req, res, next) {
            proxy.web(req, res, next);
        });
    }
};

exports['@require'] = ['igloo/settings', 'igloo/restler'];