gemini-homepage

Gemini homepage for knutsen.co
git clone git://git.knutsen.co/gemini-homepage
Log | Files | Refs | LICENSE

commit c0620bcc10ed46a7b65e341985d107b5ebb5631f
parent 08912a4c32e750f267da6385ed47c16f76116d01
Author: Demonstrandum <moi@knutsen.co>
Date:   Sun,  7 Feb 2021 15:40:39 +0000

Testing \~name paths.

Diffstat:
Mmain.go | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/main.go b/main.go @@ -80,11 +80,16 @@ func main() { } } + paramView := func(param string) (func(gig.Context) error) { + return func(c gig.Context) error { + return defaultView(c.Param("path"))(c) + } + } + s.Static("/static", "static") s.Handle("/", defaultView("index")) - s.Handle("/:path", func(c gig.Context) error { - return defaultView(c.Param("path"))(c) - }) + s.Handle("/~:name/:path", paramView("path")) + s.Handle("/:path", paramView("path")) s.Run(GEMINI_CERT, GEMINI_KEY) }