-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
可否支持CORS #5
Comments
这个问题不是很难解决,但这几天我暂时没有时间去处理,如果有人能够为此贡献那是最好的,如果没有的话,我会在之后的闲暇时间解决CORS,大概在一周内吧。 |
import express from 'express'; const app = express(); // 使用 CORS 中间件 app.use(bodyParser.json()); // 为了方便兼容多平台才这样写 async function post(req, res) { // 检查请求方法和请求体 // 判断是否备选翻译 try {
} catch (error) { async function get(req, res) { // 启动本地服务器 export { post, get }; 需要安装 cors 模块 |
我实在看不懂你上面这一段到底在表达什么,看起来像是把代码复制了一份过来……如果你想说的能跟你的标题一样就好了 |
Access to XMLHttpRequest at 'http://xxxxx.com/translate' from origin 'null' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
The text was updated successfully, but these errors were encountered: