2015-01-13 186 views
1

我是新来的招摇。在本地运行的Swagger编辑器显示空白页面

我已经在django-rest-framework中创建了API。我想记录它们。因此阅读关于招摇。

我试过django-rest-swagger,但由于缺少文档,我无法让我的代码适合文档。 因此,我正在尝试swagger编辑器,它将允许我从头开始设计API结构。我已经在本地安装了它,但它在“127.0.0.1:9000”显示空白页面。我现在应该怎么做 ?

我想编写YAML或JSON文件,这个文件将被本地安装的swagger-editor使用。我怎样才能做到这一点?

这是在控制台上的错误,当我加载127.0.0.1:9000

Warn: could not find module util 
http://127.0.0.1:9000/bower_components/angular-schema-form/dist/schema-form.js Failed to load resource: the server responded with a status of 404 (Not Found) 
angular.js:80 Uncaught Error: [$injector:nomod] Module 'schemaForm' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
http://errors.angularjs.org/1.3.2/$injector/nomod?p0=schemaForm 
angular.js:80 Uncaught Error: [$injector:modulerr] Failed to instantiate module PhonicsApp due to: 
Error: [$injector:modulerr] Failed to instantiate module schemaForm due to: 
Error: [$injector:nomod] Module 'schemaForm' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
+2

一些评论:Swagger编辑器不会消耗YAML/JSON,它会产生它。另外,如果您对编辑器有任何问题,最好直接在存储库上打开问题。最后,你现在可以在http://editor.swagger.io上使用在线编辑器。 – Ron

+0

是的,在线编辑器是一种解决方案,但有什么办法,以便我可以在我的登台服务器上做文档,因为我需要将其暴露给第三方..任何建议? – Pranav

+0

即使您在本地使用编辑器,您也需要导出JSON并将其托管到某处,因此这两者不相关。 – Ron

回答

0

我并不完全相信这是问题。作为一般说明,您可以始终清理npm和Bower模块,并再次从干净状态启动。

npm cache clean 
rm -rf node_modules 
npm install 
bower cache clean 
rm -rf app/bower_components 
bower install 
npm start 
+0

感谢您的时间,目前不能测试此代码,但是肯定我会尝试。 – Pranav

+0

这里仍然是空白页面。空白和白色。试过你的解决方案,但仍然是空白。有任何想法吗?并且凉亭安装说“凉亭ENOENT没有bower.json礼物” – momokjaaaaa

0

我遇到了同样的问题。
以前我的节点版本是最新的V6
我重新安装了一切,然后安装v4.4.4

node --v 

确保它的v4.4.4

npm install -g http-server 

wget https://github.com/swagger-api/swagger-editor/releases/download/v2.10.1/swagger-editor.zip 

unzip swagger-editor.zip 

http-server 

不使用HTTP服务器swagger-编辑