add more style

This commit is contained in:
Aleksandr Trushkin
2024-01-05 23:03:15 +03:00
parent fbe9927ac3
commit 48f5d80f7a
10 changed files with 415 additions and 134 deletions

View File

@ -100,7 +100,18 @@ func setupHTTP(cfg config.HTTP, srv xhttp.Server, log *slog.Logger) *http.Server
router.HandleFunc("/updatedesc", coursesAPI.UdpateDescription).Methods(http.MethodPost)
coursesRouter := router.PathPrefix("/courses").Subrouter()
coursesRouter.HandleFunc("/", coursesAPI.List).Methods(http.MethodGet)
coursesRouter.HandleFunc("/{course_id}", coursesAPI.Get).Methods(http.MethodGet)
courseRouter := coursesRouter.PathPrefix("/{course_id}").Subrouter()
courseRouter.HandleFunc("/", coursesAPI.Get).Methods(http.MethodGet)
courseRouter.HandleFunc("/short", coursesAPI.GetShort).Methods(http.MethodGet)
courseRouter.HandleFunc("/editdesc", coursesAPI.RenderEditDescription).Methods(http.MethodGet)
courseRouter.HandleFunc("/description", coursesAPI.UpdateCourseDescription).Methods(http.MethodPut)
if cfg.MountLive {
fs := http.FileServer(http.Dir("./assets/kurious/static/"))
router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", fs))
}
return &http.Server{
Addr: cfg.ListenAddr,