router

package
v0.0.0-...-2205d8a Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Config) http.Handler

New creates a new application router that reads and writes data to the given database implementation. In the context of the application this expects to be the only top level router in charge of handling all incoming HTTP requests.

Types

type Config

type Config func(*router)

Config adds a configuration value to the router

func WithConfig

func WithConfig(c *config.Config) Config

WithConfig attaches the given runtime config to the router.

func WithDatabase

func WithDatabase(db persistence.Service) Config

WithDatabase sets the database the router will use

func WithEmails

func WithEmails(t *template.Template) Config

WithEmails ensures the router is using the given template object for rendering email output.

func WithFS

func WithFS(fs http.FileSystem) Config

WithFS attaches a filesystem for serving static assets

func WithLogger

func WithLogger(l *logrus.Logger) Config

WithLogger sets the logger the router will use

func WithMailer

func WithMailer(m mailer.Mailer) Config

WithMailer attaches a mailer for sending transactional email

func WithTemplate

func WithTemplate(t *template.Template) Config

WithTemplate ensures the router is using the given template object for rendering dynamic HTML output.

Jump to

Keyboard shortcuts

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