How to enable CORS in MEAN STACK web app?

前端 未结 2 936
感动是毒
感动是毒 2020-12-21 00:56

I am working on a MEAN-STACK application.Using Mean-cli packgae of node. in which i am using darksky weather API, in package name Information. I have 4 other packages in cus

2条回答
  •  梦毁少年i
    2020-12-21 01:58

    If you only have one Express server, you only need to add the middleware once. Your other modules are probably provided as middleware to the server.

    If you register a middleware function without any qualifying path, like app.use(function(){ ... }), the middleware will run for every request processed by the server. It does not matter what other middleware is invoked by any given request.

    If you have multiple Express servers running simultaneously (this is fairly unlikely), then you will need to add the middleware to each server.

提交回复
热议问题