app

package
v0.0.0-...-d3d161b Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	Run() error
}

App is an interface that defines the methods that an app should implement.

type CreateShortURLRequest

type CreateShortURLRequest struct {
	LongURL string `json:"long_url"`
}

func (*CreateShortURLRequest) Validate

func (r *CreateShortURLRequest) Validate() error

type CreateShortURLResponse

type CreateShortURLResponse struct {
	ShortURL string `json:"short_url"`
}

type GetStatsRequest

type GetStatsRequest string

func (*GetStatsRequest) Validate

func (r *GetStatsRequest) Validate() error

type GetStatsResponse

type GetStatsResponse struct {
	ShortURL string `json:"short_url"`
	Hits     int    `json:"hits"`
}

type RESTApp

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

RESTApp is an app that implements the App interface.

func NewREST

func NewREST(logger *zap.Logger, router *chi.Mux, service service.Service) *RESTApp

NewREST creates a new REST app.

func (*RESTApp) RegisterRoutes

func (app *RESTApp) RegisterRoutes()

func (*RESTApp) Run

func (app *RESTApp) Run(ctx context.Context) error

Run starts the REST API server and listens for cancellation signals.

func (*RESTApp) Terminate

func (app *RESTApp) Terminate(ctx context.Context) error

type RedirectToLongURLRequest

type RedirectToLongURLRequest string

func (*RedirectToLongURLRequest) Validate

func (r *RedirectToLongURLRequest) Validate() error

Jump to

Keyboard shortcuts

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