Skip to content

Instantly share code, notes, and snippets.

@geoffreyp
Created March 22, 2017 12:16
Show Gist options
  • Save geoffreyp/55e5e1d0bee3f0bf8a5eb556a7066276 to your computer and use it in GitHub Desktop.
Save geoffreyp/55e5e1d0bee3f0bf8a5eb556a7066276 to your computer and use it in GitHub Desktop.
Simple Webservice in GoLang
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")
}
@geoffreyp
Copy link
Author

Requirements:

go get "github.com/gin-gonic/gin"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment