在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:evert0n/koa-cors开源软件地址:https://github.com/evert0n/koa-cors开源编程语言:JavaScript 99.1%开源软件介绍:koa-corsCORS middleware for Koa Inspired by the great node-cors module. npm)Installation (via$ npm install koa-cors Usagevar koa = require('koa');
var route = require('koa-route');
var cors = require('koa-cors');
var app = koa();
app.use(cors());
app.use(route.get('/', function() {
this.body = { msg: 'Hello World!' };
}));
app.listen(3000); OptionsoriginConfigures the Access-Control-Allow-Origin CORS header. Expects a string
(ex: http://example.com). Set to exposeConfigures the Access-Control-Expose-Headers CORS header. Expects a
comma-delimited string (ex: 'WWW-Authenticate,Server-Authorization') or an array
(ex: maxAgeConfigures the Access-Control-Max-Age CORS header. Set to an integer to pass the header, otherwise it is omitted. credentialsConfigures the Access-Control-Allow-Credentials CORS header. Set to methodsConfigures the Access-Control-Allow-Methods CORS header. Expects a
comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: headersConfigures the Access-Control-Allow-Headers CORS header. Expects a
comma-delimited string (ex: 'Content-Type,Authorization') or an array (ex:
For details on the effect of each CORS header, read this article on HTML5 Rocks. License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论