[READ-ONLY] Mirror of https://github.com/andrioid/gastro. Server Side templates, combining Go (frontmatter) and html/template (body) with full LSP support gastro.andri.dk
golang lsp-server template-engine
0

Configure Feed

Select the types of activity you want to include in your feed.

fix(scaffold): generated main.go uses New().Handler()

Replaces the deprecated gastro.Routes() shim in the scaffold template with gastro.New().Handler() so new projects start on the current constructor API. Refs #36.

+4 -4
+2 -2
internal/scaffold/scaffold_test.go
··· 107 107 if !strings.Contains(text, `"coolapp/.gastro"`) { 108 108 t.Errorf("main.go should import coolapp/.gastro, got:\n%s", text) 109 109 } 110 - if !strings.Contains(text, "gastro.Routes()") { 111 - t.Errorf("main.go should call gastro.Routes(), got:\n%s", text) 110 + if !strings.Contains(text, "gastro.New().Handler()") { 111 + t.Errorf("main.go should call gastro.New().Handler(), got:\n%s", text) 112 112 } 113 113 if !strings.Contains(text, "//go:generate go tool gastro generate") { 114 114 t.Errorf("main.go should contain go:generate directive for gastro generate, got:\n%s", text)
+2 -2
internal/scaffold/template/main.go.tmpl
··· 16 16 port = "4242" 17 17 } 18 18 19 - routes := gastro.Routes() 19 + handler := gastro.New().Handler() 20 20 21 21 fmt.Printf("Listening on http://localhost:%s\n", port) 22 - http.ListenAndServe(":"+port, routes) 22 + http.ListenAndServe(":"+port, handler) 23 23 }