{"id":334704,"date":"2022-06-19T15:00:22","date_gmt":"2022-06-19T15:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=334704"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=334704","title":{"rendered":"<span>HTTP \u0440\u043e\u0443\u0442\u0435\u0440 \u0434\u043b\u044f Go \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043e\u043a<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>BunRouter \u044d\u0442\u043e \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439 <a href=\"https:\/\/bunrouter.uptrace.dev\/\" rel=\"noopener noreferrer nofollow\">Golang router<\/a> \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0435\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439:<\/p>\n<ul>\n<li>\n<p><strong>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b<\/strong> (middlewares) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438\u0437 HTTP \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f <strong>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 HTTP \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043c\u0438\u0434\u043b\u0432\u0430\u0440\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0435<\/strong> \u0410\u041f\u0418, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0440\u0430\u0437\u0443: \u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 XML (<code>gin.Context<\/code> \u0438 <code>echo.Context<\/code> \u0433\u0440\u0435\u0448\u0430\u0442 \u044d\u0442\u0438\u043c).<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0434\u0430, \u043e\u043d \u043e\u0447\u0435\u043d\u044c <a href=\"https:\/\/web-frameworks-benchmark.netlify.app\/result?l=go\" rel=\"noopener noreferrer nofollow\">\u0431\u044b\u0441\u0442\u0440<\/a>, \u0445\u043e\u0442\u044f \u0438 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0440\u043e\u0443\u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u043c <a href=\"https:\/\/github.com\/valyala\/fasthttp\" rel=\"noopener noreferrer nofollow\">fasthttp<\/a>.<\/p>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e BunRouter \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0433\u043a\u0430 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <code>http.HandlerFunc<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <code>bunrouter.Request<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code class=\"go\">import \"github.com\/uptrace\/bunrouter\"  router := bunrouter.New( bunrouter.Use(reqlog.NewMiddleware()), )  router.WithGroup(\"\/api\", func(g *bunrouter.Group) { g.GET(\"\/users\/:id\", debugHandler) g.GET(\"\/users\/current\", debugHandler) g.GET(\"\/users\/*path\", debugHandler) })  func debugHandler(w http.ResponseWriter, req bunrouter.Request) error { \/\/ use req.Request to get *http.Request  return bunrouter.JSON(w, bunrouter.H{ \"route\":  req.Route(), \"params\": req.Params().Map(), }) }<\/code><\/pre>\n<p>\u041d\u043e \u043d\u0435 \u043f\u0443\u0433\u0430\u0439\u0442\u0435\u0441\u044c, BunRouter \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-router.html#compat-handlers\" rel=\"noopener noreferrer nofollow\">\u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/a> \u0438 \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 <code>http.HandlerFunc<\/code>.<\/p>\n<p>BunRouter \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 2 \u0442\u0438\u043f\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0440\u043e\u0443\u0442\u0430\u0445:<\/p>\n<ul>\n<li>\n<p><code>:param<\/code> \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u0438\u0437 \u043f\u0443\u0442\u0438 (\u0442\u0435\u043a\u0441\u0442\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u044b\u0448\u0430\u043c\u0438).<\/p>\n<\/li>\n<li>\n<p><code>*param<\/code> \u044d\u0442\u043e &#171;\u0437\u0432\u0435\u0437\u0434\u043d\u044b\u0439&#187; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u043e \u0432\u0441\u0435\u043c \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0434\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u043e\u0443\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>\/users\/:id<\/code> \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 <code>\/users\/123<\/code> \u0438 <code>\/users\/foo-bar<\/code>, \u043d\u043e \u043d\u0435 \u0441 <code>\/users\/foo\/bar<\/code>.<\/p>\n<h3>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b<\/h3>\n<p>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0438\u0434\u043b\u0432\u0430\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<pre><code class=\"go\">func middleware(next bunrouter.HandlerFunc) bunrouter.HandlerFunc {     \/\/ you can initialize the middleware here      \/\/ Return the middleware.     return func(w http.ResponseWriter, req bunrouter.Request) error {         rec := httptest.NewRecorder()          \/\/ Pass the recorder instead of http.ResponseWriter.         if err := next(rec, req); err != nil {             fmt.Printf(\"%s %s failed: %s\\n\", req.Method, req.Route(), err)             \/\/ Discard the error.             return nil         }          fmt.Printf(\"%s %s returned %d\\n\", req.Method, req.Route(), rec.Code)     } }<\/code><\/pre>\n<p>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"go\">router.Use(middleware).WithGroup(...)  \/\/ \u043b\u0438\u0431\u043e  group = group.Use(middleware)<\/code><\/pre>\n<h3>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/h3>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 BunRouter \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043c\u0438\u0434\u043b\u0432\u0430\u0440\u0430\u0445:<\/p>\n<pre><code class=\"go\">func errorHandler(next bunrouter.HandlerFunc) bunrouter.HandlerFunc { return func(w http.ResponseWriter, req bunrouter.Request) error { \/\/ Call the next handler on the chain to get the error. err := next(w, req)  switch err := err.(type) { case nil: \/\/ no error case HTTPError: \/\/ already a HTTPError w.WriteHeader(err.statusCode) _ = bunrouter.JSON(w, err) default: httpErr := NewHTTPError(err) w.WriteHeader(httpErr.statusCode) _ = bunrouter.JSON(w, httpErr) }  return err \/\/ return the err in case there other middlewares } }<\/code><\/pre>\n<p>\u0417\u0430 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435\u0441\u044c \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-http-error-handling.html\" rel=\"noopener noreferrer nofollow\">HTTP error handling<\/a>.<\/p>\n<h3>\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0440\u043e\u0443\u0442\u043e\u0432<\/h3>\n<p>\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0440\u043e\u0443\u0442\u043e\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>\/users\/<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>:id<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c &#171;\u0437\u0432\u0435\u0437\u0434\u043d\u044b\u0435&#187; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>*path<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u043e\u0443\u0442\u044b \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0443 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><code>\/users\/list<\/code> &#8212; \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u0440\u043e\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p><code>\/users\/:id<\/code> &#8212; \u0440\u043e\u0443\u0442 \u0441 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><code>\/users\/*path<\/code> &#8212; \u0440\u043e\u0443\u0442 \u0441 &#171;\u0437\u0432\u0435\u0437\u0434\u043d\u044b\u043c&#187; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c BunRouter, \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435\u0441\u044c \u043a <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-router.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0438\u043b\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/github.com\/uptrace\/bunrouter\/tree\/master\/example\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/a>.<\/p>\n<p>BunRouter \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u043e\u0432 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <a href=\"https:\/\/opentelemetry.uptrace.dev\/\" rel=\"noopener noreferrer nofollow\">OpenTelemetry<\/a> \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <a href=\"https:\/\/opentelemetry.uptrace.dev\/guide\/distributed-tracing.html\" rel=\"noopener noreferrer nofollow\">distributed tracing<\/a> \u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0440\u0435\u0439\u0441\u0438\u043d\u0433, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-http-performance.html\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 <a href=\"https:\/\/get.uptrace.dev\/compare\/distributed-tracing-tools.html\" rel=\"noopener noreferrer nofollow\">tracing tools<\/a> \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 <a href=\"https:\/\/opentelemetry.uptrace.dev\/guide\/opentelemetry-prometheus.html\" rel=\"noopener noreferrer nofollow\">Prometheus<\/a>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0445 \u0432 <a href=\"https:\/\/get.uptrace.dev\/compare\/grafana-alternatives.html\" rel=\"noopener noreferrer nofollow\">Grafana<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/672250\/\"> https:\/\/habr.com\/ru\/post\/672250\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>BunRouter \u044d\u0442\u043e \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439 <a href=\"https:\/\/bunrouter.uptrace.dev\/\" rel=\"noopener noreferrer nofollow\">Golang router<\/a> \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0435\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439:<\/p>\n<ul>\n<li>\n<p><strong>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b<\/strong> (middlewares) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438\u0437 HTTP \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f <strong>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 HTTP \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043c\u0438\u0434\u043b\u0432\u0430\u0440\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0435<\/strong> \u0410\u041f\u0418, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0440\u0430\u0437\u0443: \u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 XML (<code>gin.Context<\/code> \u0438 <code>echo.Context<\/code> \u0433\u0440\u0435\u0448\u0430\u0442 \u044d\u0442\u0438\u043c).<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0434\u0430, \u043e\u043d \u043e\u0447\u0435\u043d\u044c <a href=\"https:\/\/web-frameworks-benchmark.netlify.app\/result?l=go\" rel=\"noopener noreferrer nofollow\">\u0431\u044b\u0441\u0442\u0440<\/a>, \u0445\u043e\u0442\u044f \u0438 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0440\u043e\u0443\u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u043c <a href=\"https:\/\/github.com\/valyala\/fasthttp\" rel=\"noopener noreferrer nofollow\">fasthttp<\/a>.<\/p>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e BunRouter \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0433\u043a\u0430 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <code>http.HandlerFunc<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <code>bunrouter.Request<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code class=\"go\">import \"github.com\/uptrace\/bunrouter\"  router := bunrouter.New( bunrouter.Use(reqlog.NewMiddleware()), )  router.WithGroup(\"\/api\", func(g *bunrouter.Group) { g.GET(\"\/users\/:id\", debugHandler) g.GET(\"\/users\/current\", debugHandler) g.GET(\"\/users\/*path\", debugHandler) })  func debugHandler(w http.ResponseWriter, req bunrouter.Request) error { \/\/ use req.Request to get *http.Request  return bunrouter.JSON(w, bunrouter.H{ \"route\":  req.Route(), \"params\": req.Params().Map(), }) }<\/code><\/pre>\n<p>\u041d\u043e \u043d\u0435 \u043f\u0443\u0433\u0430\u0439\u0442\u0435\u0441\u044c, BunRouter \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-router.html#compat-handlers\" rel=\"noopener noreferrer nofollow\">\u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/a> \u0438 \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 <code>http.HandlerFunc<\/code>.<\/p>\n<p>BunRouter \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 2 \u0442\u0438\u043f\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0440\u043e\u0443\u0442\u0430\u0445:<\/p>\n<ul>\n<li>\n<p><code>:param<\/code> \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u0438\u0437 \u043f\u0443\u0442\u0438 (\u0442\u0435\u043a\u0441\u0442\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u044b\u0448\u0430\u043c\u0438).<\/p>\n<\/li>\n<li>\n<p><code>*param<\/code> \u044d\u0442\u043e &#171;\u0437\u0432\u0435\u0437\u0434\u043d\u044b\u0439&#187; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u043e \u0432\u0441\u0435\u043c \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0434\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u043e\u0443\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>\/users\/:id<\/code> \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 <code>\/users\/123<\/code> \u0438 <code>\/users\/foo-bar<\/code>, \u043d\u043e \u043d\u0435 \u0441 <code>\/users\/foo\/bar<\/code>.<\/p>\n<h3>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b<\/h3>\n<p>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0438\u0434\u043b\u0432\u0430\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<pre><code class=\"go\">func middleware(next bunrouter.HandlerFunc) bunrouter.HandlerFunc {     \/\/ you can initialize the middleware here      \/\/ Return the middleware.     return func(w http.ResponseWriter, req bunrouter.Request) error {         rec := httptest.NewRecorder()          \/\/ Pass the recorder instead of http.ResponseWriter.         if err := next(rec, req); err != nil {             fmt.Printf(\"%s %s failed: %s\\n\", req.Method, req.Route(), err)             \/\/ Discard the error.             return nil         }          fmt.Printf(\"%s %s returned %d\\n\", req.Method, req.Route(), rec.Code)     } }<\/code><\/pre>\n<p>\u041c\u0438\u0434\u043b\u0432\u0430\u0440\u044b \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"go\">router.Use(middleware).WithGroup(...)  \/\/ \u043b\u0438\u0431\u043e  group = group.Use(middleware)<\/code><\/pre>\n<h3>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/h3>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 BunRouter \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043c\u0438\u0434\u043b\u0432\u0430\u0440\u0430\u0445:<\/p>\n<pre><code class=\"go\">func errorHandler(next bunrouter.HandlerFunc) bunrouter.HandlerFunc { return func(w http.ResponseWriter, req bunrouter.Request) error { \/\/ Call the next handler on the chain to get the error. err := next(w, req)  switch err := err.(type) { case nil: \/\/ no error case HTTPError: \/\/ already a HTTPError w.WriteHeader(err.statusCode) _ = bunrouter.JSON(w, err) default: httpErr := NewHTTPError(err) w.WriteHeader(httpErr.statusCode) _ = bunrouter.JSON(w, httpErr) }  return err \/\/ return the err in case there other middlewares } }<\/code><\/pre>\n<p>\u0417\u0430 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435\u0441\u044c \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-http-error-handling.html\" rel=\"noopener noreferrer nofollow\">HTTP error handling<\/a>.<\/p>\n<h3>\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0440\u043e\u0443\u0442\u043e\u0432<\/h3>\n<p>\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0440\u043e\u0443\u0442\u043e\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>\/users\/<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>:id<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c &#171;\u0437\u0432\u0435\u0437\u0434\u043d\u044b\u0435&#187; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <code>*path<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u043e\u0443\u0442\u044b \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0443 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><code>\/users\/list<\/code> &#8212; \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u0440\u043e\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p><code>\/users\/:id<\/code> &#8212; \u0440\u043e\u0443\u0442 \u0441 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><code>\/users\/*path<\/code> &#8212; \u0440\u043e\u0443\u0442 \u0441 &#171;\u0437\u0432\u0435\u0437\u0434\u043d\u044b\u043c&#187; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c BunRouter, \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435\u0441\u044c \u043a <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-router.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0438\u043b\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/github.com\/uptrace\/bunrouter\/tree\/master\/example\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/a>.<\/p>\n<p>BunRouter \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u043e\u0432 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, <a href=\"https:\/\/opentelemetry.uptrace.dev\/\" rel=\"noopener noreferrer nofollow\">OpenTelemetry<\/a> \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <a href=\"https:\/\/opentelemetry.uptrace.dev\/guide\/distributed-tracing.html\" rel=\"noopener noreferrer nofollow\">distributed tracing<\/a> \u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0440\u0435\u0439\u0441\u0438\u043d\u0433, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/bunrouter.uptrace.dev\/guide\/golang-http-performance.html\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 <a href=\"https:\/\/get.uptrace.dev\/compare\/distributed-tracing-tools.html\" rel=\"noopener noreferrer nofollow\">tracing tools<\/a> \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 <a href=\"https:\/\/opentelemetry.uptrace.dev\/guide\/opentelemetry-prometheus.html\" rel=\"noopener noreferrer nofollow\">Prometheus<\/a>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0445 \u0432 <a href=\"https:\/\/get.uptrace.dev\/compare\/grafana-alternatives.html\" rel=\"noopener noreferrer nofollow\">Grafana<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/672250\/\"> https:\/\/habr.com\/ru\/post\/672250\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-334704","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334704"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334704\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}