I am getting the following error when sending a POST api request to my express server.
Access to XMLHttpRequest at 'localhost:8081/application' from origin 'localhost:8083' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
The express server is using the npm cors package and passport jwt authentication strategy.
privateServer.use(cors());
registerJWTAuthentication();
privateServer.all('*', authenticate('jwt', {
session: false,
}));
privateServer.addRouter('/application', privateApplicationRouter);
I am sending this request with axios from a nuxtjs application.
const result = await axios.post('localhost:8081/application', payload);
Does anyone know how to fix this CORS problem?