Skip to content

Instantly share code, notes, and snippets.

@xvbnm48
Created March 9, 2022 11:55
Show Gist options
  • Select an option

  • Save xvbnm48/ad3544c89a2a73938bf19f3bdd598126 to your computer and use it in GitHub Desktop.

Select an option

Save xvbnm48/ad3544c89a2a73938bf19f3bdd598126 to your computer and use it in GitHub Desktop.
main goi for project golang web api
package main
import (
"fmt"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
router.GET("/", rootHandler)
router.GET("/hello", helloHandler)
router.GET("books/:id/:title", booksHandler)
router.GET("/query", queryHandler)
router.POST("/books", postBooksHandler)
router.Run(":8080")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment