简体   繁体   English

OrientDB Studio代码如何工作?

[英]How OrientDB Studio Code Works?

I have a question regarding the way the OrientDB studio works. 我对OrientDB Studio的工作方式有疑问。

When I build my own web application to access the OrientDB database, I need to enable CORS and then it works, but how comes that the OrientDB studio app works without having to enable CORS? 当我构建自己的Web应用程序以访问OrientDB数据库时,我需要启用CORS,然后它才能工作,但是OrientDB Studio应用程序如何在无需启用CORS的情况下工作呢?

That's really puzzling me because I'd like to reuse the code logic of the OrientDB Studio app in my own application and it does not work like the OrientDB Studio app. 这真的让我感到困惑,因为我想在自己的应用程序中重用OrientDB Studio应用程序的代码逻辑,并且它不像OrientDB Studio应用程序那样工作。

Also, it seems that the OrientDB Studio app is using the REST API of OrientDB, not the JavaScript API (orientdb-api.js). 另外,似乎OrientDB Studio应用程序正在使用OrientDB的REST API,而不是JavaScript API(orientdb-api.js)。 Am I right? 我对吗?

Is there any documentation I could read to get a full understanding of how the Studio works? 我可以阅读任何文档以全面了解Studio的工作原理吗?

Regards, Jeremie 问候,杰里米

You need to enable CORS because your app it is outside the domain of ODB. 您需要启用CORS,因为您的应用程序位于ODB的域之外。 if you are running it in localhost is http://localhost:2480 . 如果您在localhost中运行它,则为http://localhost:2480

So if you make a request from a different domain the browser stops you if the server has CORS disabled. 因此,如果您从其他域发出请求,并且服务器禁用了CORS,浏览器将停止您的操作。

Studio starts as a plugin inside ODB http ( http://localhost:2480/studio/index.html ) so is allowed to do request without enabling CORS. Studio作为ODB http( http://localhost:2480/studio/index.html )中的插件启动,因此允许在不启用CORS的情况下进行请求。

If you do not want to enable CORS you can put your html and js under the www directory in the $ORIENTDB_HOME distribution. 如果您不想启用CORS,则可以将html和js放在$ ORIENTDB_HOME发行版中的www目录下。

There is no documentation about Studio Code. 没有有关Studio代码的文档。 You can browse it here https://github.com/orientechnologies/orientdb-studio if you need some further information you can ask me as i'm the main maintainer of Studio :D 您可以在这里浏览https://github.com/orientechnologies/orientdb-studio如果您需要更多信息,可以询问我,因为我是Studio:D的主要维护者

I can tell you that it does not use the orientdb-api.js as it uses angular.js. 我可以告诉您,它不使用orientdb-api.js,因为它使用angular.js。 I advice you to not use orientdb-api.js but uses directly the REST api with JQuery/Angular. 我建议您不要使用orientdb-api.js,而是直接将REST api与JQuery / Angular一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM