1.3 Install CORS & implement via app.js
Cross Origin Resource Sharing
wb todoMVC Master >> 1.3 install CORS & imple…
OpenAPI3 (aka swagger3) is just about ready for official release. This means steps 1.1–1.x will need to be rewritten soon. The folks over at swagger-api are working hard updating the many swag tools to work with the latest spec.
Open terminal and navigate to project
$ cd ~/Sites/swag/todo-api
Install CORS in project
$ npm install cors --save
$ open app.js
Implement CORS in app.js referencing lines 10 & 27 below
line 10: var cors = require('cors');
line 27: app.use(cors());
Gotchas (restart required?)
You may find that you have to manually restart both your swagger editor & swagger server in mock mode to prevent bugs moving forward.
The master tutorial doc is located here: WB todoMVC MASTER
Previous Step: 1.2 run swagger editor & server in mock mode