Skip to content


Quick start demo

Create main.go file


The exposing http port is provide by the port env, please bind the port read by the env.

package main

import (

func main() {
    r := gin.Default()
    r.GET("/ping", func(c *gin.Context) {
        c.JSON(200, gin.H{
            "message": "pong",
    // read the `port` env
    port := os.Getenv("PORT")
    if port == "" {
        port = "8080"
    r.Run(":" + port)

Init go.mod for project dependency

go mod init gin-demo
go mod download

Deploy to

if you haven't install lets, please take a look at the documentation: Cli Overview.

lets deploy

Powered by