mirror of
https://github.com/gin-gonic/gin.git
synced 2025-11-17 00:42:10 +08:00
docs(README): add a Trivy security scan badge (#4426)
- Add a Trivy security scan badge to the documentation - Import the log package in the example code - Improve error handling for server startup in the example code Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
5e5ff3ace4
commit
dceb61e6e7
@ -3,6 +3,7 @@
|
|||||||
<img align="right" width="159px" src="https://raw.githubusercontent.com/gin-gonic/logo/master/color.png">
|
<img align="right" width="159px" src="https://raw.githubusercontent.com/gin-gonic/logo/master/color.png">
|
||||||
|
|
||||||
[](https://github.com/gin-gonic/gin/actions/workflows/gin.yml)
|
[](https://github.com/gin-gonic/gin/actions/workflows/gin.yml)
|
||||||
|
[](https://github.com/gin-gonic/gin/actions/workflows/trivy-scan.yml)
|
||||||
[](https://codecov.io/gh/gin-gonic/gin)
|
[](https://codecov.io/gh/gin-gonic/gin)
|
||||||
[](https://goreportcard.com/report/github.com/gin-gonic/gin)
|
[](https://goreportcard.com/report/github.com/gin-gonic/gin)
|
||||||
[](https://pkg.go.dev/github.com/gin-gonic/gin?tab=doc)
|
[](https://pkg.go.dev/github.com/gin-gonic/gin?tab=doc)
|
||||||
@ -62,6 +63,7 @@ Here's a complete example that demonstrates Gin's simplicity:
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -81,7 +83,9 @@ func main() {
|
|||||||
|
|
||||||
// Start server on port 8080 (default)
|
// Start server on port 8080 (default)
|
||||||
// Server will listen on 0.0.0.0:8080 (localhost:8080 on Windows)
|
// Server will listen on 0.0.0.0:8080 (localhost:8080 on Windows)
|
||||||
r.Run()
|
if err := r.Run(); err != nil {
|
||||||
|
log.Fatalf("failed to run server: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -190,7 +194,6 @@ Gin has a rich ecosystem of middleware for common web development needs. Explore
|
|||||||
- CORS, Rate limiting, Compression
|
- CORS, Rate limiting, Compression
|
||||||
- Logging, Metrics, Tracing
|
- Logging, Metrics, Tracing
|
||||||
- Static file serving, Template engines
|
- Static file serving, Template engines
|
||||||
|
|
||||||
- **[gin-gonic/contrib](https://github.com/gin-gonic/contrib)** - Additional community middleware
|
- **[gin-gonic/contrib](https://github.com/gin-gonic/contrib)** - Additional community middleware
|
||||||
|
|
||||||
## 🏢 Production Usage
|
## 🏢 Production Usage
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user