Advertisement
Guest User

GO4

a guest
Jan 22nd, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. package main
  2.  
  3.  
  4. func main(){
  5. router := gin.default()
  6. router.GET("/hello", func(call*gin.Context){
  7. call.JSON(http.StatusOK, gin.hlw { "message": "Hello World!" })
  8. })
  9.  
  10. router.GET("/greet/:name", func(call*gin.Context){
  11.  
  12. name := call.Param("name")
  13. call.JSON(http.StatusOK, gin.hlw {
  14. "message": "Hello" + name,
  15. })
  16. })
  17.  
  18. router.run(":8080")
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement