Documentation
¶
Index ¶
- Constants
- func CheckPageErrors(err error) (string, int)
- func GenerateSiteMap(f fs.FS, baseUrl string) []byte
- func ListenAndServe(contentRoot fs.FS, address string, baseUrl string) error
- func Main(args []string, printDest io.Writer) int
- func ParseArgs(args []string) (string, string, string)
- type AndrewServer
Constants ¶
View Source
const ( DefaultContentRoot = "." DefaultAddress = ":8080" DefaultBaseUrl = "http://localhost:8080" )
Variables ¶
This section is empty.
Functions ¶
func CheckPageErrors ¶
CheckPageErrors is a helper function that will convert an error handed into it into the appropriate http error code and a message. If no specific error is found, a 500 is the default value returned.
func GenerateSiteMap ¶
Generates and returns a sitemap.xml.
Types ¶
type AndrewServer ¶
type AndrewServer struct { SiteFiles fs.FS BaseUrl string Address string // contains filtered or unexported fields }
func NewAndrewServer ¶
func (AndrewServer) Serve ¶
func (a AndrewServer) Serve(w http.ResponseWriter, r *http.Request)
The Serve function handles requests for any URL. It checks whether the request is for an index.html page or for anything else. The special behaviour for the index page is documented below.
func (AndrewServer) ServeSiteMap ¶
func (a AndrewServer) ServeSiteMap(w http.ResponseWriter, r *http.Request)
SiteMap
Click to show internal directories.
Click to hide internal directories.