add routes for block, validate block slug

This commit is contained in:
2026-02-12 23:12:30 +00:00
parent cb0d6c1d3a
commit b68ab8bc23
5 changed files with 60 additions and 4 deletions

View File

@@ -0,0 +1,26 @@
package http_block
import (
"blocky/internal/block"
"net/http"
"github.com/go-chi/chi/v5"
)
func BlockRouter(b *block.Block) chi.Router {
router := chi.NewRouter()
router.Get("/{id}", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("welcome"))
})
router.Post("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("welcome"))
})
router.Delete("/{id}", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("welcome"))
})
return router
}