api

package
v0.0.0-...-0f2d6f5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidURL        = "invalid url format"
	ErrShortCodeRequired = "short url code is required"
	ErrShortCodeNotFound = "short url not found"
)

Variables

This section is empty.

Functions

func NewLogger

func NewLogger() *logrus.Logger

func SetupRouter

func SetupRouter(server *Server) *gin.Engine

Types

type CreateShortURLRequest

type CreateShortURLRequest struct {
	URL string `json:"url" binding:"required,httpurl"`
}

type Server

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

func NewServer

func NewServer(config *config.Config, mongoClient *mongo.Client) (*Server, error)

func (*Server) CreateShortURL

func (server *Server) CreateShortURL(ctx *gin.Context)

func (*Server) DeleteShortURL

func (server *Server) DeleteShortURL(ctx *gin.Context)

func (*Server) GetOriginalURL

func (server *Server) GetOriginalURL(ctx *gin.Context)

func (*Server) GetURLStats

func (server *Server) GetURLStats(ctx *gin.Context)

func (*Server) HealthCheck

func (server *Server) HealthCheck(ctx *gin.Context)

func (*Server) Start

func (server *Server) Start() error

func (*Server) UpdateShortURL

func (server *Server) UpdateShortURL(ctx *gin.Context)

type UpdateShortURLRequest

type UpdateShortURLRequest struct {
	URL string `json:"url" binding:"required,httpurl"`
}

Jump to

Keyboard shortcuts

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