英文:
Client - Server model using Dart as Client and Go language as Server
问题
我正在尝试理解谷歌的两种编程语言。
Dart --> 生成Javascript
Go --> 生成机器码
如果我需要结合客户端-服务器模型,我想知道这个架构是如何工作的。
它是如何工作的?有没有示例或样本?
例如:请解释一下......
我输入www.learnlang.com。我期望使用Dart提供Web界面,并调用用Go语言开发的REST API。
注意:请不要涉及谷歌应用引擎。我想了解单独服务器中的模型。
谢谢。
英文:
I am trying to understand google two programing language.
Dart --> Produce Javascript
Go --> Produce machine code
If I need to combine Client - Server model. I am wondering how the architecture works.
How does it work. Is there any example/sample.
Example : Please explain this.....
I type www.learnlang.com. I expect WEB UI is served using Dart and It is calling REST API developed in GO language.
Note : Please don't relate google app engine. I am trying to understand the model in individual servers.
Thank you.
答案1
得分: 2
我认为你理解得很对!例如,你可以使用dart2js
编译你的Dart应用程序,生成JavaScript代码。然后,你可以通过一个Web服务器(如Apache或Nginx)提供这段代码。
这段代码会被客户端下载为JavaScript。你的JavaScript代码可以通过HttpRequests或WebSockets与用Go编写的后端进行连接。
你可以使用JSON、XML或其他任何你想要的方式在这两个层之间交换数据。
Go很可能作为一个进程运行,并嵌入自己的“监听HttpRequests”的机制来处理API。
英文:
I think you got it right! So for example you compile your dart app using dart2js
to produce javascript code. Then you can serve this code through a web server (like Apache or Nginx).
This code gets downloaded by clients as Javascript. Your Javascript code may connect to a backend written in Go through HttpRequests or WebSockets.
You can exchange data through both layers with JSON, XML, whatever you want.
Go will most likely run as a process, and embed its own "listening to HttpRequests" mechanism for the API.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论