Files
summercms/internal/build/testdata/new/plugins__golem15__demo__routes.go.golden
Jakub Zych a95a014b52 fix(build): scaffold plugins under plugins/<vendor>/<name> (quick-261028-pq8)
- 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
2026-10-28 18:55:46 +01:00

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
}