Fail to connect swagger editor to backend (Mongo Lab)
Hi Sahar
I am trying to user Mongo lab as backend with swagger editor, but it's fail to connect
On defaults.json I changed the following:
- "useBackendForStorage": true,
- "backendEndpoint": "http://api.mlab.com/api/1/databases/swagger/collections/specs?apiKey=<my_API>",
When I run the editor, I get the following error
XMLHttpRequest cannot load http://api.mlab.com/api/1/databases/swagger/collections/specs?XXXXXXXXXXXXXXXXXX. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access.
To solve the cross domain issue I am using CORS plugin in Chrome. But I get different error, it look like Swagger editor try to send object to mongolab.
Error: ui-ace cannot use an object or an array as a model at Array.<anonymous> (ui-ace.js:267) at ngModelWatch (angular.js:26943) at Scope.$digest (angular.js:17064) at Scope.$apply (angular.js:17337) at done (angular.js:11572) at completeRequest (angular.js:11778) at XMLHttpRequest.requestLoaded (angular.js:11711)

I tried connect Swagger Editor to different backend , always get the same error Please let me know if you want more details
Your AJAX preflight is failing. It's probably your API that causes the issue.
Hi Sahar, Do you have working sample I can check and compare with my code?
Check out this module: https://www.npmjs.com/package/swagger-editor-server