Add interactive test page.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
42dd0259af
commit
ac08289073
@ -26,7 +26,7 @@ func getListener(config conf.ConfigYaml, cwd string) net.Listener {
|
|||||||
} else {
|
} else {
|
||||||
var theListener net.Listener
|
var theListener net.Listener
|
||||||
var theError error
|
var theError error
|
||||||
log.Println("[Main] Socket Network Type:" + split[0])
|
log.Println("[Main] Socket Network Type: " + split[0])
|
||||||
log.Printf("[Main] Starting up %s server on %s...\n", config.Listen.WebMethod, config.Listen.Web)
|
log.Printf("[Main] Starting up %s server on %s...\n", config.Listen.WebMethod, config.Listen.Web)
|
||||||
switch split[0] {
|
switch split[0] {
|
||||||
case "tcp", "tcp4", "tcp6":
|
case "tcp", "tcp4", "tcp6":
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package pageHandler
|
package pageHandler
|
||||||
|
|
||||||
|
import "golang.captainalm.com/cityuni-webserver/pageHandler/pages"
|
||||||
|
|
||||||
var providers map[string]PageProvider
|
var providers map[string]PageProvider
|
||||||
|
|
||||||
func GetProviders(cacheTemplates bool, dataStorage string) map[string]PageProvider {
|
func GetProviders(cacheTemplates bool, dataStorage string) map[string]PageProvider {
|
||||||
if providers == nil {
|
if providers == nil {
|
||||||
providers = make(map[string]PageProvider)
|
providers = make(map[string]PageProvider)
|
||||||
|
providers["/test.go"] = pages.NewTestPage() //Test Page
|
||||||
//Add the providers in the pages sub package
|
//Add the providers in the pages sub package
|
||||||
}
|
}
|
||||||
return providers
|
return providers
|
||||||
|
39
pageHandler/pages/TestPage.go
Normal file
39
pageHandler/pages/TestPage.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package pages
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/url"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var startTime = time.Now()
|
||||||
|
|
||||||
|
func NewTestPage() *TestPage {
|
||||||
|
return &TestPage{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestPage struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tp *TestPage) GetPath() string {
|
||||||
|
return "/test.go"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tp *TestPage) GetSupportedURLParameters() []string {
|
||||||
|
return []string{"test"}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tp *TestPage) GetLastModified() time.Time {
|
||||||
|
return startTime
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tp *TestPage) GetContents(urlParameters url.Values) (contentType string, contents []byte) {
|
||||||
|
if val, ok := urlParameters["test"]; ok {
|
||||||
|
if len(val) > 0 {
|
||||||
|
return "text/plain", ([]byte)("Testing!\r\n" + val[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "text/plain", ([]byte)("Testing!")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tp *TestPage) PurgeTemplate() {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user