用于构建API的类似Express的框架

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

Express-like framework for building APIs

问题

我已经使用Node.js Express框架构建了一些基本的API。我正在考虑转向Go语言,因为回调代码很快就变得难以理解。我真的很喜欢Express作为一个框架,在Go语言中有类似的东西吗?

英文:

I have built some basic APIs with the node.js Express framework. I'm thinking of switching to Go, since callback code gets hard to reason about pretty quickly. I really like Express as a framework, is there something similar in Go?

答案1

得分: 5

这可能对你来说有点晚了,但我一直在开发一个 Go 版本的 Express 克隆。我声称它已经完成了 90%,只要是正确的那 90%,它就可以适用于你。

源代码:https://github.com/ricallinson/forgery 网站:http://goforgery.appspot.com/

英文:

This maybe too late for you but I've been working on a clone of Express for Go. I claim it to be 90% complete so as long as it's the right 90% it could work for you.

Source: https://github.com/ricallinson/forgery Site: http://goforgery.appspot.com/

答案2

得分: 4

Gorilla Toolkit很棒。特别是,你可能想看一下github.com/gorilla/mux。虽然有更大的框架存在,但Go语言的用户倾向于选择更简单的选项,因为语言和标准库已经可以满足大部分需求,框架并不像在其他语言中那样必要来管理复杂性,而且可能只会不必要地增加复杂性。

API文档是一个很好的参考,你还可以查看其他人如何使用它的示例

英文:

The Gorilla Toolkit is great. In particular, you might want to look at github.com/gorilla/mux. Larger frameworks exist, but go users tend to opt for the simpler option, because the language and standard library get you quite far and a framework isn't as necessary to manage the complexity as it is in other languages and may just complicate things unnecessarily.

The API docs are a good reference and you can also check out examples of how other people use it.

答案3

得分: 2

我发现go-api很有帮助,但还有其他几个框架可供选择。如果你正在寻找一个更基础的包,可以考虑Gorilla Toolkit(注意:它是一个工具包,而不是一个框架,所以它的观点较少)。

GoApi: https://github.com/dpapathanasiou/go-api
Gorilla: https://github.com/gorilla

英文:

I've found go-api helpful, but there are several other frameworks out there. If you're looking for a more basic package, the Gorilla Toolkit (note: It's a toolkit, not a framework, so it's much less opinionated)

GoApi: https://github.com/dpapathanasiou/go-api
Gorilla: https://github.com/gorilla

答案4

得分: 2

也许不是非常相似,但是你可以看一下Revel

英文:

Maybe not that similar, but give a look at Revel

huangapple
  • 本文由 发表于 2013年9月9日 03:06:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/18687526.html
匿名

发表评论

匿名网友

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

确定