> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mergent.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Gin

> Learn how to create your first task using Go and Gin

<Snippet file="quickstart/1_define_task.mdx" />

```go main.go
package main

import (
	"log"

	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	r.POST("/api/tasks", func(c *gin.Context) {
		body, _ := c.GetRawData()

		err := performTask(string(body))
		if err != nil {
			// task failed, respond with 500 so Mergent will retry
			c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
			return
		}

		// task was successful, respond with 200
		c.Status(http.StatusOK)
	})

	r.Run(":3000")
}

func performTask(body string) error {
	// This is where you'll perform your task.
	// For now, we'll just log it.
	log.Println("Performing task: ", body)

	return nil
}
```

<Snippet file="callout_params_api_reference.mdx" />

<Snippet file="quickstart/2_get_handler_url.mdx" />

<Snippet file="quickstart/3_create_first_task.mdx" />

<Snippet file="quickstart/4_next_steps.mdx" />

<AccordionGroup>
  <Snippet file="quickstart/accordion_use_cron_dashboard.mdx" />

  <Snippet file="quickstart/accordion_create_task_go.mdx" />
</AccordionGroup>

<Snippet file="learn_more.mdx" />
