# Gin Web Framework
<img align="right" width="159px" src="https://raw.githubusercontent.com/gin-gonic/logo/master/color.png">
[![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin)
[![codecov](https://codecov.io/gh/gin-gonic/gin/branch/master/graph/badge.svg)](https://codecov.io/gh/gin-gonic/gin)
[![Go Report Card](https://goreportcard.com/badge/github.com/gin-gonic/gin)](https://goreportcard.com/report/github.com/gin-gonic/gin)
[![GoDoc](https://pkg.go.dev/badge/github.com/gin-gonic/gin?status.svg)](https://pkg.go.dev/github.com/gin-gonic/gin?tab=doc)
[![Join the chat at https://gitter.im/gin-gonic/gin](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gin-gonic/gin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Sourcegraph](https://sourcegraph.com/github.com/gin-gonic/gin/-/badge.svg)](https://sourcegraph.com/github.com/gin-gonic/gin?badge)
[![Open Source Helpers](https://www.codetriage.com/gin-gonic/gin/badges/users.svg)](https://www.codetriage.com/gin-gonic/gin)
[![Release](https://img.shields.io/github/release/gin-gonic/gin.svg?style=flat-square)](https://github.com/gin-gonic/gin/releases)
[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/gin-gonic/gin)](https://www.tickgit.com/browse?repo=github.com/gin-gonic/gin)
Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks to [httprouter](https://github.com/julienschmidt/httprouter). If you need performance and good productivity, you will love Gin.
## Contents
- [Gin Web Framework](#gin-web-framework)
- [Contents](#contents)
- [Installation](#installation)
- [Quick start](#quick-start)
- [Benchmarks](#benchmarks)
- [Gin v1. stable](#gin-v1-stable)
- [Build with jsoniter](#build-with-jsoniter)
- [API Examples](#api-examples)
- [Using GET, POST, PUT, PATCH, DELETE and OPTIONS](#using-get-post-put-patch-delete-and-options)
- [Parameters in path](#parameters-in-path)
- [Querystring parameters](#querystring-parameters)
- [Multipart/Urlencoded Form](#multiparturlencoded-form)
- [Another example: query + post form](#another-example-query--post-form)
- [Map as querystring or postform parameters](#map-as-querystring-or-postform-parameters)
- [Upload files](#upload-files)
- [Single file](#single-file)
- [Multiple files](#multiple-files)
- [Grouping routes](#grouping-routes)
- [Blank Gin without middleware by default](#blank-gin-without-middleware-by-default)
- [Using middleware](#using-middleware)
- [How to write log file](#how-to-write-log-file)
- [Custom Log Format](#custom-log-format)
- [Controlling Log output coloring](#controlling-log-output-coloring)
- [Model binding and validation](#model-binding-and-validation)
- [Custom Validators](#custom-validators)
- [Only Bind Query String](#only-bind-query-string)
- [Bind Query String or Post Data](#bind-query-string-or-post-data)
- [Bind Uri](#bind-uri)
- [Bind Header](#bind-header)
- [Bind HTML checkboxes](#bind-html-checkboxes)
- [Multipart/Urlencoded binding](#multiparturlencoded-binding)
- [XML, JSON, YAML and ProtoBuf rendering](#xml-json-yaml-and-protobuf-rendering)
- [SecureJSON](#securejson)
- [JSONP](#jsonp)
- [AsciiJSON](#asciijson)
- [PureJSON](#purejson)
- [Serving static files](#serving-static-files)
- [Serving data from file](#serving-data-from-file)
- [Serving data from reader](#serving-data-from-reader)
- [HTML rendering](#html-rendering)
- [Custom Template renderer](#custom-template-renderer)
- [Custom Delimiters](#custom-delimiters)
- [Custom Template Funcs](#custom-template-funcs)
- [Multitemplate](#multitemplate)
- [Redirects](#redirects)
- [Custom Middleware](#custom-middleware)
- [Using BasicAuth() middleware](#using-basicauth-middleware)
- [Goroutines inside a middleware](#goroutines-inside-a-middleware)
- [Custom HTTP configuration](#custom-http-configuration)
- [Support Let's Encrypt](#support-lets-encrypt)
- [Run multiple service using Gin](#run-multiple-service-using-gin)
- [Graceful shutdown or restart](#graceful-shutdown-or-restart)
- [Third-party packages](#third-party-packages)
- [Manually](#manually)
- [Build a single binary with templates](#build-a-single-binary-with-templates)
- [Bind form-data request with custom struct](#bind-form-data-request-with-custom-struct)
- [Try to bind body into different structs](#try-to-bind-body-into-different-structs)
- [http2 server push](#http2-server-push)
- [Define format for the log of routes](#define-format-for-the-log-of-routes)
- [Set and get a cookie](#set-and-get-a-cookie)
- [Testing](#testing)
- [Users](#users)
## Installation
To install Gin package, you need to install Go and set your Go workspace first.
1. The first need [Go](https://golang.org/) installed (**version 1.12+ is required**), then you can use the below Go command to install Gin.
```sh
$ go get -u github.com/gin-gonic/gin
```
2. Import it in your code:
```go
import "github.com/gin-gonic/gin"
```
3. (Optional) Import `net/http`. This is required for example if using constants such as `http.StatusOK`.
```go
import "net/http"
```
## Quick start
```sh
# assume the following codes in example.go file
$ cat example.go
```
```go
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
```
```
# run example.go and visit 0.0.0.0:8080/ping (for windows "localhost:8080/ping") on browser
$ go run example.go
```
## Benchmarks
Gin uses a custom version of [HttpRouter](https://github.com/julienschmidt/httprouter)
[See all benchmarks](/BENCHMARKS.md)
| Benchmark name | (1) | (2) | (3) | (4) |
| ------------------------------ | ---------:| ---------------:| ------------:| ---------------:|
| BenchmarkGin_GithubAll | **43550** | **27364 ns/op** | **0 B/op** | **0 allocs/op** |
| BenchmarkAce_GithubAll | 40543 | 29670 ns/op | 0 B/op | 0 allocs/op |
| BenchmarkAero_GithubAll | 57632 | 20648 ns/op | 0 B/op | 0 allocs/op |
| BenchmarkBear_GithubAll | 9234 | 216179 ns/op | 86448 B/op | 943 allocs/op |
| BenchmarkBeego_GithubAll | 7407 | 243496 ns/op | 71456 B/op | 609 allocs/op |
| BenchmarkBone_GithubAll | 420 | 2922835 ns/op | 720160 B/op | 8620 allocs/op |
| BenchmarkChi_GithubAll | 7620 | 238331 ns/op | 87696 B/op | 609 allocs/op |
| BenchmarkDenco_GithubAll | 18355 | 64494 ns/op | 20224 B/op | 167 allocs/op |
| BenchmarkEcho_GithubAll | 31251 | 38479 ns/op | 0 B/op | 0 allocs/op |
| BenchmarkGocraftWeb_GithubAll | 4117 | 300062 ns/op | 131656 B/op | 1686 allocs/op |
| BenchmarkGoji_GithubAll | 3274 | 416158 ns/op | 56112 B/op | 334 allocs/op |
| BenchmarkGojiv2_GithubAll | 1402 | 870518 ns/op | 352720 B/op | 4321 allocs/op |
| BenchmarkGoJsonRest_GithubAll | 2976 | 401507 ns/op | 134371 B/op | 2737 allocs/op |
| BenchmarkGoRestful_GithubAll | 410 | 2913158 ns/op | 910144 B/op | 2938 allocs/op |
| BenchmarkGorillaMux_GithubAll | 346 | 3384987 ns/op | 251650 B/op | 1994 allocs/op |
| BenchmarkGowwwRouter_GithubAll | 10000 | 143025 ns/op | 72144 B/op | 501 allocs/op |
| BenchmarkHttpRouter_GithubAll | 55938 | 21360 ns/op | 0 B/op | 0 allocs/op |
| BenchmarkHttpTreeMux_GithubAll | 10000 | 153944 ns/op | 65856 B/op | 671 allocs/op |
| BenchmarkKocha_GithubAll |
没有合适的资源?快使用搜索试试~ 我知道了~
是源自微众银行运维管理实践的的一套配置管理数据库系统
共1304个文件
go:853个
s:54个
png:54个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 182 浏览量
2023-04-20
08:57:37
上传
评论
收藏 12.72MB ZIP 举报
温馨提示
WeCMDB(Configuration Management Database 配置管理数据库),是源自微众银行运维管理实践的的一套配置管理数据库系统。在IT运维领域中,CMDB信息的准确性和完整性一直是行业内公认的挑战。如何保证企业的IT信息从物理层,到逻辑层,到应用层以及其关系信息被准确记录,以及如何利用CMDB的信息完成各种复杂的IT运维流程,甚至实现自动化、智能化,CMDB已成为IT运维可正常开展的基石。随着云计算和互联网业务高速发展,IT资源信息成几何级增加。如何管理日益增长的IT数据,拥有一套强大的CMDB系统显得尤为重要
资源推荐
资源详情
资源评论
收起资源包目录
是源自微众银行运维管理实践的的一套配置管理数据库系统 (1304个子文件)
AUTHORS 4KB
AUTHORS 484B
AUTHORS 174B
AUTHORS 173B
AUTHORS 173B
cpu_gccgo_x86.c 1KB
gccgo_c.c 1KB
CONTRIBUTORS 1KB
CONTRIBUTORS 171B
CONTRIBUTORS 170B
CONTRIBUTORS 170B
Dockerfile 449B
.eslintignore 36B
ci-data-management-en.gif 1.31MB
ci-data-management-en.gif 1.31MB
ci-data-management.gif 1.27MB
ci-data-management.gif 1.27MB
.gitignore 383B
.gitignore 363B
.gitignore 320B
.gitignore 312B
.gitignore 280B
.gitignore 266B
.gitignore 259B
.gitignore 214B
.gitignore 117B
.gitignore 99B
.gitignore 84B
.gitignore 77B
.gitignore 54B
.gitignore 42B
.gitignore 34B
.gitignore 22B
.gitignore 16B
.gitignore 16B
.gitignore 14B
.gitignore 5B
.gitignore 5B
fast-path.generated.go 139KB
zerrors_linux.go 124KB
scannerc.go 76KB
zerrors_freebsd_arm64.go 75KB
zerrors_freebsd_386.go 75KB
gen.go 75KB
zerrors_freebsd_amd64.go 75KB
zerrors_openbsd_arm64.go 73KB
table_marshal.go 73KB
zerrors_darwin_amd64.go 73KB
zerrors_darwin_arm64.go 73KB
zerrors_darwin_386.go 73KB
zerrors_darwin_arm.go 73KB
zerrors_netbsd_386.go 73KB
zerrors_openbsd_amd64.go 72KB
zerrors_netbsd_arm64.go 72KB
zerrors_netbsd_amd64.go 72KB
zerrors_netbsd_arm.go 72KB
zerrors_freebsd_arm.go 71KB
helper.go 69KB
ci_data.go 68KB
zerrors_openbsd_arm.go 68KB
zerrors_openbsd_386.go 68KB
zerrors_dragonfly_amd64.go 67KB
zsyscall_darwin_386.go 67KB
zsyscall_darwin_amd64.go 67KB
zsyscall_darwin_arm.go 66KB
zsyscall_darwin_arm64.go 66KB
ztypes_linux.go 64KB
syscall_linux.go 63KB
baked_in.go 62KB
report.go 62KB
zerrors_solaris_amd64.go 58KB
zsyscall_solaris_amd64.go 54KB
zerrors_aix_ppc64.go 53KB
zerrors_aix_ppc.go 52KB
decode.go 52KB
table_unmarshal.go 48KB
zsyscall_freebsd_arm.go 48KB
zsyscall_freebsd_386.go 48KB
zsyscall_freebsd_amd64.go 48KB
zsyscall_freebsd_arm64.go 48KB
postgres.go 48KB
emitterc.go 44KB
zsyscall_netbsd_arm.go 44KB
zsyscall_netbsd_386.go 44KB
zsyscall_netbsd_amd64.go 44KB
zsyscall_netbsd_arm64.go 44KB
zsyscall_linux.go 43KB
zsyscall_darwin_386.1_11.go 43KB
zsyscall_darwin_amd64.1_11.go 43KB
zsyscall_aix_ppc64_gc.go 42KB
zsyscall_darwin_arm.1_11.go 42KB
zsyscall_darwin_arm64.1_11.go 42KB
zsyscall_openbsd_arm.go 40KB
zsyscall_openbsd_386.go 40KB
zsyscall_openbsd_amd64.go 39KB
zsyscall_openbsd_arm64.go 39KB
zsyscall_dragonfly_amd64.go 39KB
engine.go 37KB
ci_data_rule.go 37KB
zsysnum_freebsd_amd64.go 36KB
共 1304 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 7394
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- ResNet-50 是一个深度卷积神经网络架构,常用于图像识别任务 它是 ResNet 系列网络中的一个变种,具有 50 层深度 ResNet-50以其深度残差连接结构而闻名,这种结构允许网络训练更深
- java前后端分离vue个人博客系统源码数据库 MySQL源码类型 WebForm
- 基于ESP8266和继电器模块实现远程控制电脑电源(网页界面远程开关机).zip
- 卷积神经网络研究综述-周飞燕
- Jesse的个人博客,以梦为马,不负韶华 技术栈:HTML、CSS、JavaScript、TypeScipt、Vue、React、Angular、Node、Hybrid App、数据结构与算法等
- Mars 是微信官方的终端基础组件,是一个使用 C++ 编写的业务性无关、平台性无关的基础组件 目前已接入微信 Android、iOS、Mac、Windows、WP 等客户端
- 零基础入门计算机图形学必不可少的在线网络公开课,手把手教您现代 OpenGL 的点点滴滴,构建爆款游戏引擎 基于 OpenGL 的 3D 游戏引擎,开发出爆款开源游戏
- 基于JavaFX的UI组件库-含常用的UI组件-快速构建JavaFX应用程序界面+使用说明.zip
- 基于Java和Kotlin的炉石传说自动化脚本项目源码+说明文档.zip
- 基于Laravel开源免费的自媒体商城博客CMS企业建站系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功