www

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

Tavern UI

This package contains the relevant code for the Tavern UI. It primarily uses React + Apollo in combination with TypeScript, but depends on code generation to function properly. Read on for more development information.

Code Generation

Any relevant code generation can be executed by running go generate ./cmd/tavern/internal/www/generate.go or will automatically be executed when running go generate ./.... Code generation is responsible for:

Testing Changes

If this is your first time contributing WWW changes in this dev environment, remember to run npm install to ensure you have all required dependencies

  1. Run go generate ./... to ensure all code generation is up to date
  2. Run go run ./tavern to start the teamserver (for the GraphQL API) run in the project root
    • Note: to run the teamserver with test data (useful for UI development), run ENABLE_TEST_DATA=1 go run ./tavern instead
  3. In a separate terminal, navigate to the UI Root /cmd/tavern/internal/www and run npm start

Building the Application

When you're ready to include changes to the UI in the tavern binary, you'll need to run npm run build to update files in the build/ directory. These files will automatically be bundled into new compliations of the tavern binary.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Content embed.FS

Content embedded from the application's build directory, includes the latest build of the UI.

Functions

This section is empty.

Types

type Handler

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

Handler is a custom handler for the single page react app - if the path doesn't exist the react app is returned.

func NewHandler

func NewHandler(logger *log.Logger) *Handler

NewHandler creates and returns a handler for the Tavern UI.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP provides the Tavern UI, if the requested file does not exist it will serve index.html

Jump to

Keyboard shortcuts

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