add routes for block, validate block slug
This commit is contained in:
26
internal/http_block/http_block.go
Normal file
26
internal/http_block/http_block.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user