added some docs

This commit is contained in:
dtookey 2023-07-31 17:12:05 -04:00
parent e619a9f609
commit 7f4b41247e

View File

@ -9,6 +9,20 @@ import (
) )
type ( type (
// ConfigType is an enum representing the types of configuration routes.
// There are currently 3 options:
//
// Text - Used for simple text/HTML routes.
// Image - Used for image file routes.
// SingleFile - Used for serving a single file.
//
// These constants define the allowed values for the ConfigType
// field used when loading route configurations from a JSON file.
//
//
// So when loading a JSON config, the "ConfigType" field must be
// set to one of these constant values like "Text" or "Image".
ConfigType string ConfigType string
// ConfigEntry defines a single route configuration entry. // ConfigEntry defines a single route configuration entry.
@ -35,16 +49,33 @@ type (
) )
const ( const (
// defaultTemplateFileName is the default file name for the generated
// blank config template.
defaultTemplateFileName = "servlet.json.example.tmpl" defaultTemplateFileName = "servlet.json.example.tmpl"
defaultListeningPort = ":8080"
defaultUrlPattern = "/*" // defaultListeningPort is the default HTTP listening port.
defaultFileLocation = "errors/" // Set to ":8080" to listen on port 8080.
defaultListeningPort = ":8080"
// defaultUrlPattern is the default URL pattern route.
// Set to "/*" to match all URLs.
defaultUrlPattern = "/*"
// defaultFileLocation is the default file location to serve static files from.
// Set to "errors/" to serve from a directory called "errors".
defaultFileLocation = "errors/"
) )
const ( const (
Text ConfigType = "Text" // Text is a ConfigType constant representing a text/HTML route.
Image = "Image" Text ConfigType = "Text"
SingleFile = "SingleFile"
// Image is a ConfigType constant representing an image file route.
Image = "Image"
// SingleFile is a ConfigType constant representing a route that
// serves a single file.
SingleFile = "SingleFile"
) )
func CreateBlankConfig() *Config { func CreateBlankConfig() *Config {