Created
March 22, 2017 12:16
-
-
Save geoffreyp/55e5e1d0bee3f0bf8a5eb556a7066276 to your computer and use it in GitHub Desktop.
Simple Webservice in GoLang
This file contains 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 ( | |
"net/http" | |
"github.com/gin-gonic/gin" | |
) | |
func main() { | |
router := gin.Default() | |
router.GET("/sayhello", func(c *gin.Context) { | |
c.JSON(http.StatusOK, gin.H{ | |
"result": "Hello World", | |
}) | |
}) | |
router.Run(":3000") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requirements:
go get "github.com/gin-gonic/gin"