Skip to content
Myr

docs(README): add a Trivy security scan badge (#4426)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- 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

authored by Bo-Yi Wu · committed by GitHub · parent 5e5ff3a · Browse files · 1 file+7 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Diff stats

1 file+7 added−4 removed

  • other:+7 added−4 removed

1 file+7 added−4 removed

modified:README.md+7 added-4 removed
1 unmodified line
23<img align="right" width="159px" src="https://raw.githubusercontent.com/gin-gonic/logo/master/color.png">45[![Build Status](https://github.com/gin-gonic/gin/actions/workflows/gin.yml/badge.svg?branch=master)](https://github.com/gin-gonic/gin/actions/workflows/gin.yml)6[![Trivy Security Scan](https://github.com/gin-gonic/gin/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/gin-gonic/gin/actions/workflows/trivy-scan.yml)7[![codecov](https://codecov.io/gh/gin-gonic/gin/branch/master/graph/badge.svg)](https://codecov.io/gh/gin-gonic/gin)8[![Go Report Card](https://goreportcard.com/badge/github.com/gin-gonic/gin)](https://goreportcard.com/report/github.com/gin-gonic/gin)9[![Go Reference](https://pkg.go.dev/badge/github.com/gin-gonic/gin?status.svg)](https://pkg.go.dev/github.com/gin-gonic/gin?tab=doc)10[![Sourcegraph](https://sourcegraph.com/github.com/gin-gonic/gin/-/badge.svg)](https://sourcegraph.com/github.com/gin-gonic/gin?badge)
51 unmodified lines
62```go63package main6465import (66 "log"67 "net/http"6869 "github.com/gin-gonic/gin"70)7172func main() {73 // Create a Gin router with default middleware (logger and recovery)74 r := gin.Default()73 7576 // Define a simple GET endpoint77 r.GET("/ping", func(c *gin.Context) {78 // Return JSON response79 c.JSON(http.StatusOK, gin.H{80 "message": "pong",81 })82 })81 8384 // Start server on port 8080 (default)85 // Server will listen on 0.0.0.0:8080 (localhost:8080 on Windows)84 r.Run()86 if err := r.Run(); err != nil {87 log.Fatalf("failed to run server: %v", err)88 }89}90```9192**Running the application:**
100 unmodified lines
193 - Authentication (JWT, Basic Auth, Sessions)194 - CORS, Rate limiting, Compression195 - Logging, Metrics, Tracing196 - Static file serving, Template engines193 197- **[gin-gonic/contrib](https://github.com/gin-gonic/contrib)** - Additional community middleware198199## 🏢 Production Usage200
27 unmodified lines