logo
  • 教程列表
  • SO官方文档
  • 路由
    • 自定义 RESTful 路由定义
    • 重定向
    • 为所有视图定义自定义变量
    • 从通配符路由中跳过资产(带有点的 URL)
    • 使用 RegEx 的路线
    • URL slugs
  1. StackOverflow 文档
  2. sails.js 教程
  3. 路由
  4. 为所有视图定义自定义变量

为所有视图定义自定义变量

Created: November-22, 2018

module.exports.routes = {
  // This function will be executed for all http verbs on all urls
  'all /*', function (req, res, next) {
    // Expose the function `fooBar` to all views (via the locals object)
    res.locals.fooBar = function (arg1) {
      return 'foobar' + arg1;
    };
  },
};
  • 从通配符路由中跳过资产(带有点的 URL)
  • 重定向

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明