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

  • 關於本站
  • 免責聲明