客户端 – 服务器模型使用Dart作为客户端,Go语言作为服务器。

huangapple go评论77阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2015年4月27日 23:46:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/29900290.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定