api

package
v2.17.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HelloWorldConfig = routes.ApiRouteConfig{
	HttpMethod: routes.GET,
	Type:       routes.DYNAMIC,
}

*

  • `HelloWorldConfig` registers this handler as an API route. *
  • - `HttpMethod`: Specifies that this endpoint handles HTTP GET requests.
  • - `Type`: Controls caching behavior — routes.DYNAMIC (default, no caching),
  • routes.STATIC (cached forever), or routes.ISR (cached with TTL).
  • - `RevalidateInSec`: When Type is ISR, sets the TTL in seconds for cache entries. *
  • Example with ISR caching:
  • var MyConfig = routes.ApiRouteConfig{
  • HttpMethod: routes.GET,
  • Type: routes.ISR,
  • RevalidateInSec: 60,
  • }

Functions

func HelloWorld

func HelloWorld(w http.ResponseWriter, r *http.Request)

*

  • `HelloWorld` is a simple HTTP handler that returns a JSON object with a message. *
  • This is the only function in this file and serves as an example of Gothic’s JSON API capabilities. *
  • Response:
  • {
  • "message": "Hello World from GOTH API ROUTE"
  • }

Types

type HelloWorldResponse

type HelloWorldResponse struct {
	Message string `json:"message"`
}

HelloWorldResponse defines the structure of the JSON payload returned by the route. You can expand this with additional fields as needed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL