Skip to content

Commit 1e2a5ab

Browse files
committed
Add /week route to redirect to most recently weekly news
1 parent 924687c commit 1e2a5ab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

web/server.go

+5
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@ func Serve(db *sqlx.DB, b *bot.Bot) {
422422
_, _ = w.Write(out.Bytes())
423423
})
424424

425+
r.Get("/week", func(w http.ResponseWriter, r *http.Request) {
426+
start := summary.WeekStart(time.Now().AddDate(0, 0, -7), pacific)
427+
http.Redirect(w, r, "/week/"+start.Format(time.DateOnly), http.StatusSeeOther)
428+
})
429+
425430
r.Get("/week/{date}", func(w http.ResponseWriter, r *http.Request) {
426431
ctx := r.Context()
427432
q := model.New(db.DB)

0 commit comments

Comments
 (0)