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.

  • 相关阅读:
    开题
    kafka介绍原理
    xxl-job
    多线程使用
    基础
    linux命令
    oracle id 自增
    feign调用远程服务 并传输媒体类型
    复杂sql mybatis查询
    开源easyExcel应用
  • 原文地址:https://www.cnblogs.com/tekkaman/p/5219616.html
Copyright © 2011-2022 走看看