Enabling Cross Origin Resource sharing (CORS) in ExpressJS framework on NodeJS developed using Swagger
问题 I've hosted a nodejs server on localhost generated using Swagger and I'm trying to make API calls to it using Swagger UI again hosted on localhost. The network profile in chrome is showing connection refused everytime I'm making a call because CORS header are not added to the request. This is my app.js file which was generated using Swagger: 'use strict'; var SwaggerExpress = require('swagger-express-mw'); var app = require('express')(); module.exports = app; // for testing var config = {