Last active
April 3, 2016 11:40
-
-
Save mushfiq/49884a342169239a8a73 to your computer and use it in GitHub Desktop.
Golang based REST API deployed using Docker.
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 ( | |
"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