Created
March 9, 2022 11:55
-
-
Save xvbnm48/ad3544c89a2a73938bf19f3bdd598126 to your computer and use it in GitHub Desktop.
main goi for project golang web api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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