- new_golden_test.go: -update flag, fixed 0x00..0x1f key, sibling summercms symlink - testdata/new (16 files + next steps) and testdata/new-no-plugin (6) - plugin go.mod replace and absent root go.sum asserted instead of pinned
24 lines
540 B
Plaintext
24 lines
540 B
Plaintext
package demo
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"git.golem15.com/golem15/summercms/modules/pact"
|
|
)
|
|
|
|
var _ pact.HasRoutes = (*Plugin)(nil)
|
|
|
|
// Routes registers the starter route: GET / answers with a JSON greeting
|
|
// naming this plugin.
|
|
func (p *Plugin) Routes(r pact.Router) error {
|
|
r.Get("/{$}", func(w http.ResponseWriter, req *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
_ = json.NewEncoder(w).Encode(map[string]string{
|
|
"message": "Hello from SummerCMS",
|
|
"plugin": p.ID(),
|
|
})
|
|
})
|
|
return nil
|
|
}
|