* Remove Negroni in favor of the standard net/http server. * Remove gorilla/mux in favor of the standard net/http NewServeMux. * Remove gorilla/sessions in favor of Redis session_id cookie. * Remove the hacky glue controllers setup in favor of regular defined routes in the router.go file directly. * Update all Go dependencies for Go 1.24 * Move and centralize all the HTTP middlewares. * Add middlewares for Logging and Recovery to replace Negroni's.
29 lines
594 B
Go
29 lines
594 B
Go
package controllers
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// BlogSearch at "/blog/search" for searching blog entries.
|
|
func BlogSearch(w http.ResponseWriter, r *http.Request) {
|
|
// var (
|
|
// query = r.FormValue("q")
|
|
// pageStr = r.FormValue("page")
|
|
// page int
|
|
// )
|
|
|
|
// if a, err := strconv.Atoi(pageStr); err == nil {
|
|
// page = a
|
|
// }
|
|
|
|
// pp, err := models.Posts.SearchPosts(query, page, 20)
|
|
|
|
// v := responses.NewTemplateVars(w, r)
|
|
// v.V["post"] = post
|
|
|
|
// // Render the body.
|
|
// v.V["rendered"] = post.HTML()
|
|
|
|
// responses.RenderTemplate(w, r, "_builtin/blog/view-post.gohtml", v)
|
|
}
|