@4geit/swg-allow-cross-domain-helper 中文文档教程
@4geit/swg-allow-cross-domain-helper
设置 CORS 标头
Installation
- A recommended way to install @4geit/swg-allow-cross-domain-helper is through npm package manager using the following command:
npm i @4geit/swg-allow-cross-domain-helper --save
或使用 yarn
使用以下命令:
yarn add @4geit/swg-allow-cross-domain-helper
- All you have to do is to import the
@4geit/swg-allow-cross-domain-helper
package in your controller or mock file as below:
// ...
const swgAllowCrossDomainHelper = require('@4geit/swg-allow-cross-domain-helper');
// ...
并将其与您的端点控制器之一一起使用,如下所示:
// ...
module.exports = {
// ...
getItems: swgAllowCrossDomainHelper(
(req, res) => {
// ...
}
),
// ...
};
@4geit/swg-allow-cross-domain-helper
set CORS headers
Installation
- A recommended way to install @4geit/swg-allow-cross-domain-helper is through npm package manager using the following command:
npm i @4geit/swg-allow-cross-domain-helper --save
Or use yarn
using the following command:
yarn add @4geit/swg-allow-cross-domain-helper
- All you have to do is to import the
@4geit/swg-allow-cross-domain-helper
package in your controller or mock file as below:
// ...
const swgAllowCrossDomainHelper = require('@4geit/swg-allow-cross-domain-helper');
// ...
And use it with one of your endpoint controller as below:
// ...
module.exports = {
// ...
getItems: swgAllowCrossDomainHelper(
(req, res) => {
// ...
}
),
// ...
};