handlers

package
v0.0.0-...-7ffce48 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MPL-2.0 Imports: 6 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 struct {
	DB *gorm.DB
}

App represents the appplication itself

func (*App) CreateShortURL

func (a *App) CreateShortURL(w http.ResponseWriter, r *http.Request)

CreateShortURL will take a url and shorten it with an (custom) alias

func (*App) GetURL

func (a *App) GetURL(w http.ResponseWriter, r *http.Request)

GetURL takes a shortlink and redirects the user to the relevant link if it exists

func (*App) Initialize

func (a *App) Initialize(dbDriver string, dbURI string)

Initialize initializes the app, connects to database, and does auto migration

func (*App) ListAll

func (a *App) ListAll(w http.ResponseWriter, r *http.Request)

ListAll returns a JSON response of all the url entries in the database

Jump to

Keyboard shortcuts

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