vue报错:
Access to XMLHttpRequest at 'http://localhost:3000/User/register' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
这是报错的代码:
切记:
app.use(cors())一定要在app.use()其他中间件的最前面!!!!!!!!!!
这是更改后的代码: