zoukankan      html  css  js  c++  java
  • app.use

    app.use

      Mounts the middleware function(s) at the path. If path is not specified, it defaults to “/”.

      A route will match any path, which follows its path immediately with a “/”. For example: app.use('/apple', ...) will match “/apple”, “/apple/images”, “/apple/images/news”, and so on.

      req.originalUrl in a middleware is a combination of req.baseUrl and req.path, as shown in the following example.

      

      

      Middleware functions are executed sequentially, therefore the order of middleware inclusion is important.

      

      路径可以是 path、path pattern、regular expression.

      Disable logging for static content requests by loading the logger middleware after the static middleware:

      

    参考:http://www.expressjs.com.cn/4x/api.html#app.use

    __dirname

      nodejs中的全局变量。

      The name of the directory that the currently executing script resides in.

      Example: running node example.js from /Users/mjr

      

      __dirname isn't actually a global but rather local to each module.

  • 相关阅读:
    0909 初识编译原理
    校园跳蚤市场-Sprint计划
    校园跳蚤市场
    5.2-5.3
    5.1封装
    阅读2
    汉堡包
    五章-问题
    结对子作业 四则运算 V2.0
    四则运算升级版
  • 原文地址:https://www.cnblogs.com/tekkaman/p/5219616.html
Copyright © 2011-2022 走看看