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.
Click to show internal directories.
Click to hide internal directories.