Skip to content

Instantly share code, notes, and snippets.

@mushfiq
Last active April 3, 2016 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mushfiq/49884a342169239a8a73 to your computer and use it in GitHub Desktop.
Save mushfiq/49884a342169239a8a73 to your computer and use it in GitHub Desktop.
Golang based REST API deployed using Docker.
package main
import (
"github.com/gin-gonic/gin"
"time"
)
func rootHandler(context *gin.Context) {
current_time := time.Now()
current_time.Format("20060102150405")
context.JSON(200, gin.H{
"current_time": current_time,
})
}
func main() {
router := gin.Default()
router.GET("/", rootHandler)
router.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment