routes/web.go
このサイトを動かすコードです。どのファイルから読めばよいかは第14章の読み順で確認できます。
package routes
import (
"io/fs"
"go.laravel.com/config"
"go.laravel.com/routing"
"laravel-go-kaitai/handlers"
)
func Web(route *routing.Router, _ *config.Config, sources fs.FS) {
route.Get("/", handlers.Home).Name("home")
route.Get("/chapters", handlers.Index).Name("chapters")
route.Get("/chapters/{slug}", handlers.Chapter).Name("chapter")
route.Get("/progress", handlers.Progress).Name("progress")
route.Post("/chapters/{slug}/progress", handlers.UpdateProgress).Name("chapter.progress")
route.Get("/glossary", handlers.Glossary).Name("glossary")
route.Get("/lab", handlers.Lab).Name("lab")
route.Post("/lab", handlers.SubmitLab).Name("lab.submit")
route.Get("/source/{name}", handlers.Source(sources)).Name("source")
handlers.AccountRoutes(route)
route.Fallback(handlers.NotFound)
}