I have used “cors” but I found “Access to XMLHttpRequest has been blocked”. Why?
问题 I have an express API running and when I make a request I get this message. Error: Access to XMLHttpRequest at 'http://localhost:9000/api/courses' from origin 'http://localhost:4222' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I am using cors in my API here is my code: import * as express from 'express'; import {Application} from "express"; import {getAllCourses, getCourseById} from "./get-courses.route"; import {searchLessons