与HTML和Go进行前端交互

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

Go Front End Interaction with HTML and Go

问题

我是你的中文翻译助手,以下是翻译好的内容:

我刚开始学习Go语言,最近一直在学习《Go之旅》,因为我认为它是一种非常强大的语言,比PHP等语言要好得多。学习Go还是Python一直是一个很大的争议,但我觉得Go是未来的发展方向。

我现在想知道如何将Go与实际的网页结合起来。我在网上搜索了很多关于如何与前端(如HTML)进行交互的资源,但是找不到任何资料。

我想要能够完成一些传统的任务,比如从HTML表单中获取用户输入,从数据库中检索数据,根据用户名的可用性动态更新界面等等。Go能够与前端进行交互吗?

第二个问题是在使用Go时是否需要Ajax。

我知道这些问题非常基础,但我真的找不到如何让Golang与前端进行交互的方法。如果有人能够提供你所知道的资源链接或示例代码,那将非常棒!谢谢。

英文:

I'm new to Go and I've recently been going through the "Tour of Go" because I think it is/will be a very powerful language to use, much better than PHP and such. It was a big debate between learning Go or Python, but I feel Go is the path of the future.

I'm at the point in my learning that I want to know how to incorporate Go with an actual web page. I have searched everywhere on the web for how to interact with the front end side of things, like HTML, but I cannot find resources anywhere.

I'd like to be able to do your traditional tasks, such as user input from HTML forms, database retrieval, dynamically updating the interface with if say, a username is available or not. Will Go be capable of interacting with the front end of things?

A second question is if Ajax is even needed when using Go.

I know these are really entry-level questions, but I really can't find out how to get Golang to interact with the front end side of things. So if anyone could please provide links to resources you might know of, or example code, that'd be wonderful! Thank you.

答案1

得分: 2

是的,你可以使用Go编写Web应用程序。Go标准库包含了构建各种类型的Web应用程序所需的大部分内容。

Go语言网站上的维基文章是学习如何使用Go编写Web应用程序的好地方。

使用Go编写Ajax应用程序很容易。与其他服务器端语言一样,是否使用Ajax完全取决于你。

英文:

Yes, you can write a web application with Go. The Go standard library includes most everything you need to build many types of web applications.

The wiki article on the Go Language website is a good place to learn about how to write a web applicaton with Go.

It's easy to write Ajax applications with Go. As with other server side languages, the use of Ajax is up to you.

huangapple
  • 本文由 发表于 2014年9月23日 06:16:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/25983922.html
匿名

发表评论

匿名网友

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

确定