NodeJS / Express: what is “app.use”?

后端 未结 23 1423
别跟我提以往
别跟我提以往 2020-11-29 14:48

In the docs for the NodeJS express module, the example code has app.use(...).

What is the use function and where is it defined?

23条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 15:10

    It enables you to use any middleware (read more) like body_parser,CORS etc. Middleware can make changes to request and response objects. It can also execute a piece of code.

提交回复
热议问题