{"id":329972,"date":"2022-02-22T15:02:07","date_gmt":"2022-02-22T15:02:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=329972"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=329972","title":{"rendered":"<span>\u041a\u0430\u043a \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 Go-\u0440\u043e\u0443\u0442\u0435\u0440? (\u0441 \u0431\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u043e\u0439)<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/21b\/6bc\/7ef\/21b6bc7ef4deeba316ecdcfed8dd831b.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/21b\/6bc\/7ef\/21b6bc7ef4deeba316ecdcfed8dd831b.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c Go, \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u0430\u0434\u0430\u0434\u0438\u0442\u0435\u0441\u044c, \u2014 <em>\u201c\u041a\u0430\u043a\u043e\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u043c\u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c?\u201d<\/em>.<\/p>\n<p>\u0418 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430. \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0431\u043e\u043b\u0435\u0435 100 <a href=\"https:\/\/github.com\/search?l=Go&amp;p=5&amp;q=http+router&amp;type=Repositories\">\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432<\/a> \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 API, \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043e\u0446\u0435\u043d\u0438\u043b 30 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445 \u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043b\u0443\u0447\u0448\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0431\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong> \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e, \u0442\u043e \u0432\u044b \u0441\u043c\u0435\u043b\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a <a href=\"https:\/\/www.alexedwards.net\/blog\/which-go-router-should-i-use#flowchart\">\u0431\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u0435<\/a>.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (method-based routing)<\/strong> \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (&#171;GET&#187;, &#171;POST&#187; \u0438 \u0442. \u0434.).<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 URL-\u043f\u0443\u0442\u044f\u0445 (variables in URL paths)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <code>\/movies\/{id}<\/code>, \u0433\u0434\u0435 <code>{id}<\/code> \u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 URL-\u043f\u0443\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (regexp route patterns) <\/strong>\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <code>\/movies\/{[az-]+}<\/code> \u0433\u0434\u0435 <code>[az-]+<\/code> \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 URL-\u043f\u0443\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430 (host-based routes)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <em>\u0445\u043e\u0441\u0442\u0430 <\/em>URL (\u0432\u0440\u043e\u0434\u0435 <a href=\"http:\/\/www.example.com\"><u>www.example.com<\/u><\/a>), \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e URL-<em>\u043f\u0443\u0442\u0438<\/em>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (custom routing rules)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (\u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Authorization).<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u043c\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438 (conflicting routes)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u0434\u0432\u0430 (\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435) \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 URL-\u043f\u0443\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b <code>\/blog\/{slug}<\/code> \u0438 <code>\/blog\/new<\/code>, \u0442\u043e HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u0443\u0442\u0435\u043c <code>\/blog\/new<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c <em>\u043e\u0431\u043e\u0438\u043c<\/em> \u044d\u0442\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong> \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u2014 \u044d\u0442\u043e <em>\u043f\u043b\u043e\u0445\u043e<\/em>. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b, \u0438 \u0432\u0430\u043c \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0438\u0445 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<h3>\u0420\u043e\u0443\u0442\u0435\u0440\u044b, \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u0432 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a\u00a0<\/h3>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0430\u043c \u043c\u043e\u0435\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430 \u0432 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0448\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430. \u042d\u0442\u043e <a href=\"https:\/\/pkg.go.dev\/net\/http#ServeMux\">http.ServeMux<\/a>, <a href=\"https:\/\/github.com\/julienschmidt\/httprouter\">julienschmidt\/httprouter<\/a>, <a href=\"https:\/\/github.com\/go-chi\/chi\">go-chi\/chi<\/a> \u0438 <a href=\"https:\/\/github.com\/gorilla\/mux\">gorilla\/mux<\/a>. \u0412\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u043c\u0438 (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c) API \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 http.Handler, http.HandlerFunc \u0438 <a href=\"https:\/\/www.alexedwards.net\/blog\/making-and-using-middleware\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c middleware<\/a>.<\/p>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0442\u043e \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430 <em>\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b<\/em> (\u043f\u043e\u0447\u0442\u0438) \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u044b, \u0430 \u043d\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041b\u0438\u0447\u043d\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 \u0440\u0430\u0437\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0438 \u0431\u044b\u043b \u0438\u043c\u0438 \u0432\u0441\u0435\u043c\u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0432\u043e\u043b\u0435\u043d.<\/p>\n<h4>http.ServeMux<\/h4>\n<p>\u041d\u0430\u0447\u043d\u0443 \u044f \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/pkg.go.dev\/net\/http#ServeMux\">http.ServeMux<\/a>, \u0442\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0432\u0430\u043c \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>\u041a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Go, \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0431\u043e\u0435\u0432\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445. \u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Go \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0413\u0430\u0440\u0430\u043d\u0442\u0438\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 Go 1 \u0442\u0430\u043a\u0436\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432 \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0439 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435 http.ServeMux \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0441\u0435\u0439\u0447\u0430\u0441. \u0412\u0441\u0435 \u044d\u0442\u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043f\u043b\u044e\u0441\u0430\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430, URL \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0430\u043d\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0430 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u0435\u043d: \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043d\u0430\u0434 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c\u0438. \u0423 \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442: \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, <em>\u0438 \u044d\u0442\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/em>.<\/p>\n<p>\u0414\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f http.ServeMux \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 URL-\u043f\u0443\u0442\u044f\u0445. \u041d\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0432\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u2014 \u0435\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"go\">func main() {     mux := http.NewServeMux()     mux.HandleFunc(\"\/\", index)      err := http.ListenAndServe(\":3000\", mux)     log.Fatal(err) }  func index(w http.ResponseWriter, r *http.Request) {     if r.URL.Path != \"\/\" {         http.NotFound(w, r)         return     }      \/\/ \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432...      switch r.Method {     case http.MethodGet:         \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 GET \u0437\u0430\u043f\u0440\u043e\u0441\u0430...      case http.MethodPost:         \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430...      case http.MethodOptions:         w.Header().Set(\"Allow\", \"GET, POST, OPTIONS\")         w.WriteHeader(http.StatusNoContent)      default:         w.Header().Set(\"Allow\", \"GET, POST, OPTIONS\")         http.Error(w, \"method not allowed\", http.StatusMethodNotAllowed)     } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432\u044b \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b 404 \u0438 405 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 OPTIONS \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0418 \u044d\u0442\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e http.ServeMux \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u043e\u0440\u043e\u043d \u0438 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0435\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u044f \u0431\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b <em>\u043d\u0435<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u043f\u0443\u0442\u044f\u0445 URL \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 http.ServeMux \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u0438 \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0440\u043e\u0443\u0442\u0435\u0440.<\/p>\n<h4>julienschmidt\/httprouter<\/h4>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e <a href=\"https:\/\/github.com\/julienschmidt\/httprouter\">julienschmidt\/httprouter<\/a> \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u0438\u0437\u043e\u043a \u043a \u201c\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0443\u201d, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f\u043c HTTP. \u041e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 URL-\u0430\u0434\u0440\u0435\u0441\u0430. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 OPTIONS \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 405, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 404 \u0438 405.<\/p>\n<p>\u041e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e httprouter <em>\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432<\/em>, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \/post\/create \u0438 \/post\/:id. \u041e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c <em>\u043d\u0443\u0436\u043d\u043e<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0441 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439).<\/p>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 httprouter \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0435\u0433\u043e API \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u0430\u043b\u0435\u043a\u0438 \u043e\u0442 \u0438\u0434\u0435\u0430\u043b\u0430. \u041f\u0430\u043a\u0435\u0442 \u0431\u044b\u043b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0434\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 Go 1.7, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 API \u0432\u0441\u0435 \u0435\u0449\u0435 \u0436\u0438\u0432\u0443\u0442 \u0432 \u0440\u0435\u0430\u043b\u0438\u044f\u0445 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 Go. \u0412 \u043d\u0430\u0448\u0438 \u0434\u043d\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b http.Handler \u0438 http.HandlerFunc, \u0438 \u0432\u0441\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b <code>router.Handler()<\/code> \u0438 <code>router.HandlerFunc()<\/code> \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"go\">func main() {     router := httprouter.New()      router.HandlerFunc(\"GET\", \"\/\", indexGet)     router.HandlerFunc(\"POST\", \"\/\", indexPost)      err := http.ListenAndServe(\":3000\", mux)     log.Fatal(err) }  func indexGet(w http.ResponseWriter, r *http.Request) {     \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 GET \u0437\u0430\u043f\u0440\u043e\u0441\u0430... }  func indexPost(w http.ResponseWriter, r *http.Request) {     \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430... }<\/code><\/pre>\n<h4>go-chi\/chi<\/h4>\n<p>\u041f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/go-chi\/chi\">go-chi\/chi<\/a> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 URL-\u043f\u0443\u0442\u044f\u0445 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u041a\u0430\u043a \u0438 httprouter, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 404 \u0438 405.<\/p>\n<p>\u041d\u043e \u0447\u0442\u043e \u043c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0432 <code>chi<\/code>, \u0442\u0430\u043a \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u201c\u0433\u0440\u0443\u043f\u043f\u044b\u201d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 middleware, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043d\u0438\u0436\u0435. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0433\u0434\u0435 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e middleware \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"go\">r := chi.NewRouter()  \/\/ Middleware \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u0445 r.Use(exampleMiddlewareOne) r.Use(exampleMiddlewareTwo)  r.Get(\"\/one\", exampleHandlerOne)  r.Group(func(r chi.Router) {     \/\/ Middleware \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432     r.Use(exampleMiddlewareThree)      r.Get(\"\/two\", exampleHandlerTwo) })<\/code><\/pre>\n<p><code>chi<\/code> <em>\u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442<\/em> \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b.<\/p>\n<p>\u0414\u0432\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430 chi \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 OPTIONS \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Allow \u0432 \u043e\u0442\u0432\u0435\u0442\u0430\u0445 405. \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 API, \u0442\u043e \u044d\u0442\u0438 \u0432\u0435\u0449\u0438, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u043d\u0430\u0434 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c API, \u0442\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u0432\u0438\u0434\u0443. \u041a\u0430\u043a \u0438 httprouter, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0435\u0440\u0435\u0436\u0435\u043d\u0438\u044f: \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 6 \u043b\u0435\u0442 \u0431\u044b\u043b\u043e 5 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 <code>chi<\/code>, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043d\u043e \u043d\u0430\u043c\u0435\u043a\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0438 \u043e\u0442\u043a\u0430\u0437 \u043e\u0442 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u044b\u043c\u0438 \u0434\u043b\u044f <code>chi<\/code>, \u0447\u0435\u043c \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043d\u0438\u0445, httprouter \u0438 gorilla\/mux \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u0432\u043d\u043e\u0441\u0438\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<h4>gorilla\/mux<\/h4>\n<p>\u041f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/gorilla\/mux\">gorilla\/mux<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 Go \u0440\u043e\u0443\u0442\u0435\u0440, \u0438 \u043d\u0430 \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 URL-\u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430. \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u201c\u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u201d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430<\/strong> (route reversing &#8212; \u043a\u0430\u043a \u0432 Django, Rails \u0438\u043b\u0438 Laravel). \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 404 \u0438 405.<\/p>\n<p>\u0415\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0442\u0430\u043a\u0438\u0435 \u0436\u0435, \u043a\u0430\u043a \u0443 <code>chi<\/code> \u2014 \u043e\u043d <em>\u043d\u0435<\/em> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 OPTIONS \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a\u00a0 Allow \u0432 405 \u043e\u0442\u0432\u0435\u0442\u044b. \u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u043a\u0430\u043a \u0438 <code>chi<\/code>, \u043e\u043d <em>\u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442<\/em> \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b.<\/p>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 <code>chi<\/code> \u0438 gorilla\/mux \u0441\u0445\u043e\u0436\u0438, \u0432\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 gorilla\/mux , \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430 \u0438\u043b\u0438 \u201c\u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u201d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u044d\u0442\u0438 \u201c\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435\u201d \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c <code>chi<\/code> \u0438\u0437-\u0437\u0430 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f middleware, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h4>\u041c\u043e\u0439 \u201c\u043f\u0440\u0438\u0437 \u0437\u0440\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0441\u0438\u043c\u043f\u0430\u0442\u0438\u0439\u201d<\/h4>\n<p>\u0414\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043a\u0430\u043a \u044f \u0434\u0443\u043c\u0430\u044e, \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0442 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f, \u044d\u0442\u043e <a href=\"https:\/\/github.com\/bmizerany\/pat\">bmizerany\/pat<\/a> \u0438 <a href=\"https:\/\/github.com\/matryer\/way\">matryer\/way<\/a>. \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0438\u043c\u043f\u0430\u0442\u0438\u044f \u043a \u043e\u0431\u043e\u0438\u043c \u0438\u0437 \u043d\u0438\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 <em>\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0435<\/em>. \u0423 \u043d\u0438\u0445 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 API \u0438 \u043e\u0447\u0435\u043d\u044c \u0447\u0435\u0442\u043a\u0438\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c. \u041e\u0447\u0435\u043d\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043a\u043e\u0434\u043e\u043c, \u043b\u0435\u0436\u0430\u0449\u0438\u043c \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 matryer\/way.<\/p>\n<p>\u0425\u043e\u0442\u044f \u043e\u043d\u0438 \u043c\u0435\u043d\u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 \u043c\u043e\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0435, \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0438\u0441\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0433\u043e\u0444\u0435\u0440\u043e\u0432) \u0438\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438\/\u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u043e\u0443\u0442\u0435\u0440.<\/p>\n<h3>\u0411\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u0430<\/h3>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u044d\u0442\u0430 \u0431\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5a4\/51a\/4d3\/5a451a4d38306c4e91ae256b16577f19.png\" width=\"659\" height=\"1123\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5a4\/51a\/4d3\/5a451a4d38306c4e91ae256b16577f19.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u044b<\/h3>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043b, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043d\u0438\u0436\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435\u043c, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e\u0449\u0438\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong> \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 <em>\u201c\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0444\u0430\u0439\u043b go.mod ?\u201d<\/em> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0442\u043e\u0433\u043e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u0434\u043e\u0432\u0430\u044f \u0431\u0430\u0437\u0430 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u043d\u0435\u0442. \u041c\u043d\u0435 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c \u2014 \u0435\u0441\u043b\u0438 \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0432\u043e\u0432\u043b\u0435\u0447\u0435\u043d \u0432 \u043c\u0438\u0440 Go \u0438 \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u043a\u043e\u0434\u0435, \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043e\u043d \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0431\u044b \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><strong>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>\u041f\u0440\u0438\u0447\u0438\u043d\u0430<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/celrenheit\/lion\">celrenheit\/lion<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/claygod\/Bxog\">claygod\/Bxog<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/clevergo\/clevergo\">clevergo\/clevergo<\/a><\/p>\n<\/td>\n<td>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043d\u0435 http.Handler \u0438\u043b\u0438 http.HandlerFunc).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/dimfeld\/httptreemux\">dimfeld\/httptreemux<\/a><\/p>\n<\/td>\n<td>\n<p>\u041d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 http.Handler. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f middleware \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 404\/405.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/donutloop\/mux\">donutloop\/mux<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/gernest\/alien\">gernest\/alien<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/go-ozzo\/ozzo-routing\">go-ozzo\/ozzo-routing<\/a><\/p>\n<\/td>\n<td>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043d\u0435 http.Handler \u0438\u043b\u0438 http.HandlerFunc).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/go-playground\/lars\">go-playground\/lars<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/go-zoo\/bone\">go-zoo\/bone<\/a><\/p>\n<\/td>\n<td>\n<p>\u0425\u043e\u0440\u043e\u0448, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e chi. \u041d\u0435\u043f\u043e\u043b\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/go101\/tinyrouter\">go101\/tinyrouter<\/a><\/p>\n<\/td>\n<td>\n<p>\u0418\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432. \u041d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u044b 405.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/gocraft\/web\">gocraft\/web<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/goji\/goji\">goji\/goji<\/a><\/p>\n<\/td>\n<td>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439, \u043d\u043e \u0433\u0438\u0431\u043a\u0438\u0439 API, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0438. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f middleware \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 404\/405. \u0425\u043e\u0440\u043e\u0448, \u043d\u043e \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e gorilla\/mux \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0449\u0435 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/goroute\/route\">goroute\/route<\/a><\/p>\n<\/td>\n<td>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043d\u0435 http.Handler \u0438\u043b\u0438 http.HandlerFunc).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/gowww\/router\">gowww\/router<\/a><\/p>\n<\/td>\n<td>\n<p>\u0425\u043e\u0440\u043e\u0448, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e chi. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a 405.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/GuilhermeCaruso\/bellt\">GuilhermeCaruso\/bellt<\/a><\/p>\n<\/td>\n<td>\n<p>\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 404 \u0438\u043b\u0438 405.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/husobee\/vestigo\">husobee\/vestigo<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e http.HandlerFunc.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/naoina\/denco\">naoina\/denco<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/nbari\/violetear\">nbari\/violetear<\/a><\/p>\n<\/td>\n<td>\n<p>\u0425\u043e\u0440\u043e\u0448, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e chi. \u041e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 http.ResponseWriter \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u0442\u0438\u043f\u043e\u043c, \u0447\u0442\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/nbio\/hitch\">nbio\/hitch<\/a><\/p>\n<\/td>\n<td>\n<p>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/nissy\/bon\">nissy\/bon<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/razonyang\/fastrouter\">razonyang\/fastrouter<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/rs\/xmux\">rs\/xmux<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043d\u0435 http.Handler \u0438\u043b\u0438 http.HandlerFunc).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/takama\/router\">takama\/router<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/vardius\/gorouter\">vardius\/gorouter<\/a><\/p>\n<\/td>\n<td>\n<p>\u0425\u043e\u0440\u043e\u0448, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e chi. \u0427\u0435\u0442\u044b\u0440\u0435 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430 5 \u043b\u0435\u0442 \u043d\u0430\u043c\u0435\u043a\u0430\u044e\u0442, \u0447\u0442\u043e API \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u044b\u043c.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/VividCortex\/siesta\">VividCortex\/siesta<\/a><\/p>\n<\/td>\n<td>\n<p>\u0425\u043e\u0440\u043e\u0448, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e chi. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a 405.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p><a href=\"https:\/\/github.com\/xujiajun\/gorouter\">xujiajun\/gorouter<\/a><\/p>\n<\/td>\n<td>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430<a href=\"https:\/\/otus.pw\/hDh3\/\"> &#171;Golang Developer. Professional&#187;<\/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\/company\/otus\/blog\/653009\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/653009\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c Go, \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u0430\u0434\u0430\u0434\u0438\u0442\u0435\u0441\u044c, \u2014 <em>\u201c\u041a\u0430\u043a\u043e\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u043c\u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c?\u201d<\/em>.<\/p>\n<p>\u0418 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430. \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0431\u043e\u043b\u0435\u0435 100 <a href=\"https:\/\/github.com\/search?l=Go&amp;p=5&amp;q=http+router&amp;type=Repositories\">\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432<\/a> \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 API, \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043e\u0446\u0435\u043d\u0438\u043b 30 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445 \u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043b\u0443\u0447\u0448\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0431\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong> \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e, \u0442\u043e \u0432\u044b \u0441\u043c\u0435\u043b\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a <a href=\"https:\/\/www.alexedwards.net\/blog\/which-go-router-should-i-use#flowchart\">\u0431\u043b\u043e\u043a-\u0441\u0445\u0435\u043c\u0435<\/a>.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (method-based routing)<\/strong> \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (&#171;GET&#187;, &#171;POST&#187; \u0438 \u0442. \u0434.).<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 URL-\u043f\u0443\u0442\u044f\u0445 (variables in URL paths)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <code>\/movies\/{id}<\/code>, \u0433\u0434\u0435 <code>{id}<\/code> \u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 URL-\u043f\u0443\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (regexp route patterns) <\/strong>\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <code>\/movies\/{[az-]+}<\/code> \u0433\u0434\u0435 <code>[az-]+<\/code> \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 URL-\u043f\u0443\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430 (host-based routes)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <em>\u0445\u043e\u0441\u0442\u0430 <\/em>URL (\u0432\u0440\u043e\u0434\u0435 <a href=\"http:\/\/www.example.com\"><u>www.example.com<\/u><\/a>), \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e URL-<em>\u043f\u0443\u0442\u0438<\/em>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (custom routing rules)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0440\u043e\u0443\u0442\u0435\u0440 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (\u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Authorization).<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434 <strong>\u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u043c\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438 (conflicting routes)<\/strong> \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u0434\u0432\u0430 (\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435) \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 URL-\u043f\u0443\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b <code>\/blog\/{slug}<\/code> \u0438 <code>\/blog\/new<\/code>, \u0442\u043e HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u0443\u0442\u0435\u043c <code>\/blog\/new<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c <em>\u043e\u0431\u043e\u0438\u043c<\/em> \u044d\u0442\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong> \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u2014 \u044d\u0442\u043e <em>\u043f\u043b\u043e\u0445\u043e<\/em>. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b, \u0438 \u0432\u0430\u043c \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0438\u0445 \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<h3>\u0420\u043e\u0443\u0442\u0435\u0440\u044b, \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u0432 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a\u00a0<\/h3>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0430\u043c \u043c\u043e\u0435\u0433\u043e \u043e\u0442\u0431\u043e\u0440\u0430 \u0432 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0448\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430. \u042d\u0442\u043e <a href=\"https:\/\/pkg.go.dev\/net\/http#ServeMux\">http.ServeMux<\/a>, <a href=\"https:\/\/github.com\/julienschmidt\/httprouter\">julienschmidt\/httprouter<\/a>, <a href=\"https:\/\/github.com\/go-chi\/chi\">go-chi\/chi<\/a> \u0438 <a href=\"https:\/\/github.com\/gorilla\/mux\">gorilla\/mux<\/a>. \u0412\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u043c\u0438 (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c) API \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 http.Handler, http.HandlerFunc \u0438 <a href=\"https:\/\/www.alexedwards.net\/blog\/making-and-using-middleware\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c middleware<\/a>.<\/p>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0442\u043e \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430 <em>\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b<\/em> (\u043f\u043e\u0447\u0442\u0438) \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u044b, \u0430 \u043d\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041b\u0438\u0447\u043d\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 \u0440\u0430\u0437\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0438 \u0431\u044b\u043b \u0438\u043c\u0438 \u0432\u0441\u0435\u043c\u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0432\u043e\u043b\u0435\u043d.<\/p>\n<h4>http.ServeMux<\/h4>\n<p>\u041d\u0430\u0447\u043d\u0443 \u044f \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/pkg.go.dev\/net\/http#ServeMux\">http.ServeMux<\/a>, \u0442\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0432\u0430\u043c \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>\u041a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Go, \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0431\u043e\u0435\u0432\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445. \u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Go \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0413\u0430\u0440\u0430\u043d\u0442\u0438\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 Go 1 \u0442\u0430\u043a\u0436\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432 \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0439 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435 http.ServeMux \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0441\u0435\u0439\u0447\u0430\u0441. \u0412\u0441\u0435 \u044d\u0442\u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043f\u043b\u044e\u0441\u0430\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430, URL \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0430\u043d\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0430 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u0435\u043d: \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043d\u0430\u0434 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c\u0438. \u0423 \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442: \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, <em>\u0438 \u044d\u0442\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/em>.<\/p>\n<p>\u0414\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f http.ServeMux \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 URL-\u043f\u0443\u0442\u044f\u0445. \u041d\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0432\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u2014 \u0435\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"go\">func main() {     mux := http.NewServeMux()     mux.HandleFunc(\"\/\", index)      err := http.ListenAndServe(\":3000\", mux)     log.Fatal(err) }  func index(w http.ResponseWriter, r *http.Request) {     if r.URL.Path != \"\/\" {         http.NotFound(w, r)         return     }      \/\/ \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432...      switch r.Method {     case http.MethodGet:         \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 GET \u0437\u0430\u043f\u0440\u043e\u0441\u0430...      case http.MethodPost:         \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430...      case http.MethodOptions:         w.Header().Set(\"Allow\", \"GET, POST, OPTIONS\")         w.WriteHeader(http.StatusNoContent)      default:         w.Header().Set(\"Allow\", \"GET, POST, OPTIONS\")         http.Error(w, \"method not allowed\", http.StatusMethodNotAllowed)     } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0432\u044b \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b 404 \u0438 405 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 OPTIONS \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0418 \u044d\u0442\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e http.ServeMux \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u043e\u0440\u043e\u043d \u0438 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0435\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u044f \u0431\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b <em>\u043d\u0435<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u043f\u0443\u0442\u044f\u0445 URL \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 http.ServeMux \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u0438 \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0440\u043e\u0443\u0442\u0435\u0440.<\/p>\n<h4>julienschmidt\/httprouter<\/h4>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e <a href=\"https:\/\/github.com\/julienschmidt\/httprouter\">julienschmidt\/httprouter<\/a> \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u0438\u0437\u043e\u043a \u043a \u201c\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0443\u201d, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f\u043c HTTP. \u041e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 URL-\u0430\u0434\u0440\u0435\u0441\u0430. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 OPTIONS \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 405, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 404 \u0438 405.<\/p>\n<p>\u041e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e httprouter <em>\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432<\/em>, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \/post\/create \u0438 \/post\/:id. \u041e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c <em>\u043d\u0443\u0436\u043d\u043e<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0441 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439).<\/p>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 httprouter \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0435\u0433\u043e API \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u0430\u043b\u0435\u043a\u0438 \u043e\u0442 \u0438\u0434\u0435\u0430\u043b\u0430. \u041f\u0430\u043a\u0435\u0442 \u0431\u044b\u043b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0434\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 Go 1.7, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 API \u0432\u0441\u0435 \u0435\u0449\u0435 \u0436\u0438\u0432\u0443\u0442 \u0432 \u0440\u0435\u0430\u043b\u0438\u044f\u0445 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 Go. \u0412 \u043d\u0430\u0448\u0438 \u0434\u043d\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b http.Handler \u0438 http.HandlerFunc, \u0438 \u0432\u0441\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b <code>router.Handler()<\/code> \u0438 <code>router.HandlerFunc()<\/code> \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"go\">func main() {     router := httprouter.New()      router.HandlerFunc(\"GET\", \"\/\", indexGet)     router.HandlerFunc(\"POST\", \"\/\", indexPost)      err := http.ListenAndServe(\":3000\", mux)     log.Fatal(err) }  func indexGet(w http.ResponseWriter, r *http.Request) {     \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 GET \u0437\u0430\u043f\u0440\u043e\u0441\u0430... }  func indexPost(w http.ResponseWriter, r *http.Request) {     \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430... }<\/code><\/pre>\n<h4>go-chi\/chi<\/h4>\n<p>\u041f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/go-chi\/chi\">go-chi\/chi<\/a> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 URL-\u043f\u0443\u0442\u044f\u0445 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u041a\u0430\u043a \u0438 httprouter, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 404 \u0438 405.<\/p>\n<p>\u041d\u043e \u0447\u0442\u043e \u043c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0432 <code>chi<\/code>, \u0442\u0430\u043a \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u201c\u0433\u0440\u0443\u043f\u043f\u044b\u201d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 middleware, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043d\u0438\u0436\u0435. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0433\u0434\u0435 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e middleware \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"go\">r := chi.NewRouter()  \/\/ Middleware \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u0445 r.Use(exampleMiddlewareOne) r.Use(exampleMiddlewareTwo)  r.Get(\"\/one\", exampleHandlerOne)  r.Group(func(r chi.Router) {     \/\/ Middleware \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432     r.Use(exampleMiddlewareThree)      r.Get(\"\/two\", exampleHandlerTwo) })<\/code><\/pre>\n<p><code>chi<\/code> <em>\u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442<\/em> \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b.<\/p>\n<p>\u0414\u0432\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430 chi \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 OPTIONS \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Allow \u0432 \u043e\u0442\u0432\u0435\u0442\u0430\u0445 405. \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 API, \u0442\u043e \u044d\u0442\u0438 \u0432\u0435\u0449\u0438, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u043d\u0430\u0434 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c API, \u0442\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u0432\u0438\u0434\u0443. \u041a\u0430\u043a \u0438 httprouter, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0435\u0440\u0435\u0436\u0435\u043d\u0438\u044f: \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 6 \u043b\u0435\u0442 \u0431\u044b\u043b\u043e 5 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 <code>chi<\/code>, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043d\u043e \u043d\u0430\u043c\u0435\u043a\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0438 \u043e\u0442\u043a\u0430\u0437 \u043e\u0442 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u044b\u043c\u0438 \u0434\u043b\u044f <code>chi<\/code>, \u0447\u0435\u043c \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043d\u0438\u0445, httprouter \u0438 gorilla\/mux \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u0432\u043d\u043e\u0441\u0438\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<h4>gorilla\/mux<\/h4>\n<p>\u041f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/gorilla\/mux\">gorilla\/mux<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 Go \u0440\u043e\u0443\u0442\u0435\u0440, \u0438 \u043d\u0430 \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 URL-\u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430. \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <strong>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u201c\u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u201d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430<\/strong> (route reversing &#8212; \u043a\u0430\u043a \u0432 Django, Rails \u0438\u043b\u0438 Laravel). \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 404 \u0438 405.<\/p>\n<p>\u0415\u0433\u043e<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-329972","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329972","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=329972"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329972\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=329972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=329972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=329972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}