web

package
v0.0.0-...-1140a65 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package web serves a sample web server that hosts URLS to

serve various programs in The-GPL book. It is also invokes from the
docker command line to be served on Google Cloud.
logger prints log messages to standard output, whereas fmt.Printf outputs to
http.ResponseWriter

Index

Constants

View Source
const (
	// IndexPage entry point go HTML page
	IndexPage = "index.gohtml"
	// AboutPage shows about page
	AboutPage = "about.gohtml"
	// LisMandelPage shows Lissajous and Mandelbrot images
	LisMandelPage = "lismandel.gohtml"
	// SurfacesPage shows computed SVG images
	SurfacesPage = "surfaces.gohtml"

	// LisImageHanding image page Headings
	LisImageHanding = "Lissajous Surface"
	// MandelImageHanding Page Headings
	MandelImageHanding = "Mandelbrot Fractal Color"
	// MandelBWImageHanding Page Headings
	MandelBWImageHanding = "Mandelbrot Fractal in Black and White"

	// EggSurfaceHeading for egg surface page
	EggSurfaceHeading = "An Egg Surface"
	// SincSurfaceHeading for sinc page
	SincSurfaceHeading = "A Sinc Function"
	// ValleySurfaceHeading for valley surface page
	ValleySurfaceHeading = "A Valley"
	// SquareSurfaceHeading for square surface page
	SquareSurfaceHeading = "Squares"
)

Template names and Page headings

Variables

This section is empty.

Functions

func InitCli

func InitCli()

InitCli for command: the-gpl server

eg: the-gpl server -port=8888 # Starts http on port

func Start

func Start(port int)

Start a server that hosts pages:

	/ - root page
	/lis - Lissajous graph handler
 /egg - shows an egg on a page
	/incr - increments a page counter, protected by mutex
	/counter - shows value of counter, protected by mutex

Types

type AboutPageData

type AboutPageData struct {
	Active string
	Data   []SocialCard
}

AboutPageData contains Active Page name and Data for the index page

type Active

type Active string

Active defines current active page, one of enums

const (
	// Post is index page
	Post Active = "post"
	// Lis page draws Lissajous images
	Lis Active = "lis"
	// Mandel page draws Mandelbrot fractals images
	Mandel Active = "mandel"
	// MandelBW page draws Mandelbrot fractals black and white images
	MandelBW Active = "mandelbw"
	// Sinc drawn on a 3D surface
	Sinc Active = "sinc"
	// Egg drawn on a 3D surface
	Egg Active = "egg"
	// Valley drawn on a 3D surface
	Valley Active = "valley"
	// Square drawn on a 3D surface
	Square Active = "sq"
	// About page
	About Active = "about"
)

func (Active) String

func (s Active) String() string

String convert Active page name to a valid string compared in template

type CLI

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

func (CLI) DisplayHelp

func (s CLI) DisplayHelp()

DisplayHelp prints help on command line for lissajous module

func (CLI) ExecCmd

func (s CLI) ExecCmd(args []string)

ExecCmd run server from CLI

type ImagePath

type ImagePath string

ImagePath lists URL paths for SVG surfaces

func (ImagePath) String

func (s ImagePath) String() string

String converts ImagePath to string

type ImagesPageData

type ImagesPageData struct {
	Active, ImageName, Heading string
}

ImagesPageData defines data for templates

type IndexPageData

type IndexPageData struct {
	Active string
	Data   map[string]string
}

IndexPageData contains Active Page name and Data for the index page

type SVGPageData

type SVGPageData struct {
	Active       string
	SVGImageName string
	Heading      string
}

SVGPageData contains Active Page name and Data for the index page

type SVGSurfacePath

type SVGSurfacePath string

SVGSurfacePath lists URL paths for SVG surfaces

func (SVGSurfacePath) String

func (s SVGSurfacePath) String() string

String converts SVGSurfacePath to string

type SocialCard

type SocialCard struct {
	Image, ImageAlt                         string
	Title                                   string
	SocialMessage, SocialLink, SocialHandle string
}

SocialCard defines data on a social card

Jump to

Keyboard shortcuts

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