1. 首页
  2. 开源项目

Gin Web Framework Web 框架 Gin Web Framework

xuanbao • 13601 次点击
这是一个分享于 的项目,其中的信息可能已经有所发展或是发生改变。
Gin 是一个用 Go 语言开发的 Web 框架,提供类 Martini 的 API,但是性能更好。因为有了 [httprouter](http://www.oschina.net/p/httprouter) 性能提升了 40 倍之多。 ![Gin console logger](http://static.oschina.net/uploads/img/201505/15073359_kaF3.jpg) <pre class="brush:shell;toolbar: true; auto-links: false;">$ cat test.go</pre> <pre class="brush:cpp ;toolbar: true; auto-links: false;">package main import ( &#34;net/http&#34; &#34;github.com/gin-gonic/gin&#34; ) func main() { router := gin.Default() router.GET(&#34;/&#34;, func(c *gin.Context) { c.String(http.StatusOK, &#34;hello world&#34;) }) router.GET(&#34;/ping&#34;, func(c *gin.Context) { c.String(http.StatusOK, &#34;pong&#34;) }) router.POST(&#34;/submit&#34;, func(c *gin.Context) { c.String(http.StatusUnauthorized, &#34;not authorized&#34;) }) router.PUT(&#34;/error&#34;, func(c *gin.Context) { c.String(http.StatusInternalServerError, &#34;an error happened :(&#34;) }) router.Run(&#34;:8080&#34;) }</pre>
授权协议:
MIT
开发语言:
Google Go 查看源码»
操作系统:
跨平台
13601 次点击
暂无回复
添加一条新回复 (您需要 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传

用户登录

没有账号?注册
(追記) (追記ここまで)

今日阅读排行

    加载中

一周阅读排行

    加载中