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
@ -1,10 +1,13 @@
|
||||
package pageHandler
|
||||
|
||||
import "golang.captainalm.com/cityuni-webserver/pageHandler/pages"
|
||||
|
||||
var providers map[string]PageProvider
|
||||
|
||||
func GetProviders(cacheTemplates bool, dataStorage string) map[string]PageProvider {
|
||||
if providers == nil {
|
||||
providers = make(map[string]PageProvider)
|
||||
providers["/test.go"] = pages.NewTestPage() //Test Page
|
||||
//Add the providers in the pages sub package
|
||||
}
|
||||
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