- make:plugin writes plugins/<vendor>/<name> with module <app>/plugins/<vendor>/<name>; the package name stays <name> - make:* and the models-leaf check look in summer.yaml, then plugins/<vendor>/<name>, then the older plugins/<name> - summer new puts its starter plugin at plugins/golem15/<name> - refuse a vendor directory that is a legacy plugin module and a second copy of a plugin that already sits in plugins/<name> - help text and docs, with an upgrading note: moving is optional
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
|
|
}
|