api

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusRequestContextCanceled = 499
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RestApi

type RestApi struct {
	// contains filtered or unexported fields
}

RestApi represents a RESTful API server encapsulating an HTTP server, router, and static page configuration.

func NewRestApi

func NewRestApi(conf config.StaticPagesConfig) *RestApi

NewRestApi initializes and returns a new RestApi instance configured with the provided StaticPagesConfig.

func (*RestApi) Serve

func (r *RestApi) Serve(addr string) humane.Error

Serve starts the REST API Server on the specified address and returns a humane.Error if any issue occurs during startup.

func (*RestApi) ServeAsync

func (r *RestApi) ServeAsync(addr string)

ServeAsync starts the REST API server asynchronously on the specified address by calling Serve within a goroutine. If the server fails to start, it logs a fatal error with contextual details including error advice and cause.

func (*RestApi) Shutdown

func (r *RestApi) Shutdown() humane.Error

Shutdown gracefully stops the proxy server if it is running, releasing any resources and handling in-progress requests. It returns a humane.Error if the server fails to stop.

func (*RestApi) UploadHandler

func (r *RestApi) UploadHandler(ct *gin.Context)

UploadHandler handles file upload requests, processes uploaded content, and returns a corresponding HTTP response.

Jump to

Keyboard shortcuts

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