caddy_qrcode

package module
v0.0.0-...-cbb2465 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 11 Imported by: 0

README

caddy-qrcode

Caddy v2 module to generate a QR code based on the URL provided in the request.

Installation

You can build Caddy by yourself by installing xcaddy and running:

xcaddy build --with github.com/lum8rjack/caddy-qrcode

If you want to clone and make any changes, you can test locally with the following command:

# Specify the location of the local build
 xcaddy build --with github.com/lum8rjack/caddy-qrcode=./caddy-qrcode
Caddyfile

Below is an example Caddyfile that will return a QR code PNG file based on the text provided in the 'url' parameter of the request.

https://test.example.com {
  handle /img/qrcode {
    route {
      qrcode {
        param url
      }
    }
  }
}

The request below will generate a QR code for 'google.com'.

curl https://test.example.com/img/qrcode?url=google.com

References

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DEFAULT_SIZE int = 200
)

Functions

This section is empty.

Types

type QRCode

type QRCode struct {
	Param string
	Size  int
	// contains filtered or unexported fields
}

QRCode implements an HTTP handler

func (QRCode) CaddyModule

func (QRCode) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*QRCode) Provision

func (q *QRCode) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (QRCode) ServeHTTP

func (q QRCode) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP implements caddyhttp.QRCodeHandler.

func (*QRCode) UnmarshalCaddyfile

func (q *QRCode) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

func (*QRCode) Validate

func (q *QRCode) Validate() error

Validate implements caddy.Validator.

Jump to

Keyboard shortcuts

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