{"id":181548,"date":"2013-05-30T17:49:03","date_gmt":"2013-05-30T13:49:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=181548"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=181548","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0430\u0439\u0442 \u043d\u0430 D<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<habracut\/>\u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0441\u044f \u044f\u0437\u044b\u043a D. \u041d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 \u043e\u043d \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0438\u0437-\u0437\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e\u0431 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0434\u043b\u044f D. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u043d\u043e \u044d\u0442\u0438 \u044f\u0437\u044b\u043a\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c vibe.d;<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 dmd \u0438 vibe.d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0430. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043f\u043e\u0434 windows \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0432 PATH<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  <code>vibe init project_name<\/code><br \/>  \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443(3 \u043f\u0430\u043f\u043a\u0438 \u0438 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442)<br \/>  .\/views \u2014 \u0448\u0430\u0431\u043b\u043e\u043d\u044b <br \/>  .\/public \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0430\u043b\u044f *.css,*.js<br \/>  .\/src \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code>\/\/app.d  import vibe.d; import std.stdio; import std.string; import std.file; import std.array;  \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438  void image (HTTPServerRequest req, HTTPServerResponse res) { \tauto file = format(&quot;.\/public\/images\/%s&quot;, req.params[&quot;f&quot;]); \t \tif(exists(file)) \t{ \t\tauto image = cast(ubyte[]) read(file); \t\tres.writeBody(image,&quot;image&quot;); \t} \telse \t{ \t\tres.writeBody(&quot;Not Found&quot;,&quot;text\/plain&quot;); \t} }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 , \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f  void style (HTTPServerRequest req, HTTPServerResponse res) { \tauto css = readText(format(&quot;.\/public\/styles\/%s&quot;, req.params[&quot;f&quot;])); \tres.writeBody(css,&quot;text\/css&quot;); }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 , \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 CSS  void error(HTTPServerRequest req, HTTPServerResponse res, HTTPServerErrorInfo error) { \tres.writeBody(&quot;Some error, man&quot;,&quot;text\/plain&quot;); }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a  void index_req(HTTPServerRequest req, HTTPServerResponse res) { \t \tauto request = req.params[&quot;r&quot;]; \t \t\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430  \t \tres.renderCompat!(&quot;index.dt&quot;, HTTPServerRequest, &quot;req&quot;,string,&quot;title&quot;)(req,request); \t\/\/ \u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0432 \u043d\u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430. }  void index(HTTPServerRequest req, HTTPServerResponse res) { \t \t \tres.renderCompat!(&quot;index.dt&quot;, HTTPServerRequest, &quot;req&quot;,string,&quot;title&quot;)(req,&quot;Main page&quot;); \t\/\/ \u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0432 \u043d\u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430. }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 , \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043e \u0432\u0441\u044f\u043a\u0438\u043c\u0438 \u043f\u043b\u044e\u0448\u043a\u0430\u043c\u0438.     shared static this() {   \tauto settings = new HttpServerSettings; \tsettings.port = 8080; \t \t\/\/ \u041f\u043e\u0434\u043d\u044f\u043b\u0438 http \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 8080 \t \t\/\/settings.errorPageHandler = toDelegate(&error); \t\/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a \t \t \t\/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043b\u044f\u0440 \u0440\u043e\u0443\u0442\u0435\u0440\u0430(\u043e\u043d \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441) \tauto router = new URLRouter; \trouter.get(&quot;\/:r&quot;,&index_req); \trouter.get(&quot;\/&quot;,&index); \trouter.get(&quot;\/style\/:f&quot;,&style); \trouter.get(&quot;\/images\/:f&quot;,&image); \t\/\/\u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0430\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \t \tlistenHTTP(settings,router); \t\/\/\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 }<\/code><\/pre>\n<p>  \u0412 vibe \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0440\u043d\u044b\u0439, \u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439. \u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435 JADE. CSS \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043d\u043e \u0441\u0442\u0438\u043b\u0438 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 public.\u0424\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 views. <\/p>\n<pre><code class=\"markdown\">!!! 5 html \thead \t\ttitle Hi world \t\tmeta(charset=&quot;utf-8&quot;) \t\tlink(rel=&quot;stylesheet&quot;,href=&quot;\/style\/main.css&quot;) \tbody \t\tdiv#menu \t\t\ta#logo(href=&quot;\/&quot;) \t\t\tdiv.links  \t\t\t\ta(href=&quot;\/main&quot;)Main page \t\t\t\ta(href=&quot;\/about&quot;)About \t\t\t\ta(href=&quot;\/some&quot;)Some \t\tdiv#content \t\t\tdiv.article \t\t\t\th3 #{title} \t\t\t\tp Sorry,not founded <\/code><\/pre>\n<p>  \u041d\u0435\u043e\u0441\u043f\u043e\u0440\u0438\u043c\u044b\u0439 \u043f\u043b\u044e\u0441 vibed \u2014 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438. \u041e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0434\u0435\u0431\u0430\u0433 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0421\u0435\u0431\u0435 \u043d\u0430\u0434\u0435\u043b\u0430\u043b \u043f\u0430\u0440\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0434\u043b\u044f Notepad++.<\/p>\n<p>  <code>vibe build <\/code><\/p>\n<p>  \u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430(\u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430).<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u043b\u044e\u0441 \u044d\u0442\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u2014 \u0411\u0430\u0442\u0430\u0440\u0435\u0439\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e. \u041f\u0440\u0438 \u0442\u043e\u043c, \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 cgi \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u0421 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438(\u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u043b).<\/p>\n<p>  \u041f\u043b\u044e\u0441\u044b: \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430, \u041d\u0438\u0437\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430\u0446\u0438\u044f, \u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c(\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 http, \u043d\u043e \u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 tcp)<br \/>  \u041c\u0438\u043d\u0443\u0441\u044b: \u0421\u044b\u0440\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u044f\u0437\u044b\u043a\u0430, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e<\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0432\u043f\u043e\u043b\u043d\u0435 \u043d\u0435\u043f\u043b\u043e\u0445 \u0438 \u0443\u0434\u043e\u0431\u0435\u043d. \u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0434\u0443\u043c\u0430\u044e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442 GO,node.js.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/181548\/\"> http:\/\/habrahabr.ru\/post\/181548\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<habracut\/>\u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0441\u044f \u044f\u0437\u044b\u043a D. \u041d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 \u043e\u043d \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0438\u0437-\u0437\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e\u0431 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0434\u043b\u044f D. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u043d\u043e \u044d\u0442\u0438 \u044f\u0437\u044b\u043a\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c vibe.d;<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 dmd \u0438 vibe.d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0430. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043f\u043e\u0434 windows \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0432 PATH<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  <code>vibe init project_name<\/code><br \/>  \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443(3 \u043f\u0430\u043f\u043a\u0438 \u0438 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442)<br \/>  .\/views \u2014 \u0448\u0430\u0431\u043b\u043e\u043d\u044b <br \/>  .\/public \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0430\u043b\u044f *.css,*.js<br \/>  .\/src \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code>\/\/app.d  import vibe.d; import std.stdio; import std.string; import std.file; import std.array;  \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438  void image (HTTPServerRequest req, HTTPServerResponse res) { \tauto file = format(&quot;.\/public\/images\/%s&quot;, req.params[&quot;f&quot;]); \t \tif(exists(file)) \t{ \t\tauto image = cast(ubyte[]) read(file); \t\tres.writeBody(image,&quot;image&quot;); \t} \telse \t{ \t\tres.writeBody(&quot;Not Found&quot;,&quot;text\/plain&quot;); \t} }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 , \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f  void style (HTTPServerRequest req, HTTPServerResponse res) { \tauto css = readText(format(&quot;.\/public\/styles\/%s&quot;, req.params[&quot;f&quot;])); \tres.writeBody(css,&quot;text\/css&quot;); }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 , \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 CSS  void error(HTTPServerRequest req, HTTPServerResponse res, HTTPServerErrorInfo error) { \tres.writeBody(&quot;Some error, man&quot;,&quot;text\/plain&quot;); }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a  void index_req(HTTPServerRequest req, HTTPServerResponse res) { \t \tauto request = req.params[&quot;r&quot;]; \t \t\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430  \t \tres.renderCompat!(&quot;index.dt&quot;, HTTPServerRequest, &quot;req&quot;,string,&quot;title&quot;)(req,request); \t\/\/ \u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0432 \u043d\u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430. }  void index(HTTPServerRequest req, HTTPServerResponse res) { \t \t \tres.renderCompat!(&quot;index.dt&quot;, HTTPServerRequest, &quot;req&quot;,string,&quot;title&quot;)(req,&quot;Main page&quot;); \t\/\/ \u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0432 \u043d\u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430. }  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 , \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043e \u0432\u0441\u044f\u043a\u0438\u043c\u0438 \u043f\u043b\u044e\u0448\u043a\u0430\u043c\u0438.     shared static this() {   \tauto settings = new HttpServerSettings; \tsettings.port = 8080; \t \t\/\/ \u041f\u043e\u0434\u043d\u044f\u043b\u0438 http \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 8080 \t \t\/\/settings.errorPageHandler = toDelegate(&#038;error); \t\/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a \t \t \t\/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043b\u044f\u0440 \u0440\u043e\u0443\u0442\u0435\u0440\u0430(\u043e\u043d \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441) \tauto router = new URLRouter; \trouter.get(&quot;\/:r&quot;,&#038;index_req); \trouter.get(&quot;\/&quot;,&#038;index); \trouter.get(&quot;\/style\/:f&quot;,&#038;style); \trouter.get(&quot;\/images\/:f&quot;,&#038;image); \t\/\/\u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0430\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \t \tlistenHTTP(settings,router); \t\/\/\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 }<\/code><\/pre>\n<p>  \u0412 vibe \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0440\u043d\u044b\u0439, \u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439. \u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435 JADE. CSS \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043d\u043e \u0441\u0442\u0438\u043b\u0438 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 public.\u0424\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 views. <\/p>\n<pre><code class=\"markdown\">!!! 5 html \thead \t\ttitle Hi world \t\tmeta(charset=&quot;utf-8&quot;) \t\tlink(rel=&quot;stylesheet&quot;,href=&quot;\/style\/main.css&quot;) \tbody \t\tdiv#menu \t\t\ta#logo(href=&quot;\/&quot;) \t\t\tdiv.links  \t\t\t\ta(href=&quot;\/main&quot;)Main page \t\t\t\ta(href=&quot;\/about&quot;)About \t\t\t\ta(href=&quot;\/some&quot;)Some \t\tdiv#content \t\t\tdiv.article \t\t\t\th3 #{title} \t\t\t\tp Sorry,not founded <\/code><\/pre>\n<p>  \u041d\u0435\u043e\u0441\u043f\u043e\u0440\u0438\u043c\u044b\u0439 \u043f\u043b\u044e\u0441 vibed \u2014 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438. \u041e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0434\u0435\u0431\u0430\u0433 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0421\u0435\u0431\u0435 \u043d\u0430\u0434\u0435\u043b\u0430\u043b \u043f\u0430\u0440\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0434\u043b\u044f Notepad++.<\/p>\n<p>  <code>vibe build <\/code><\/p>\n<p>  \u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430(\u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430).<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u043b\u044e\u0441 \u044d\u0442\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u2014 \u0411\u0430\u0442\u0430\u0440\u0435\u0439\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e. \u041f\u0440\u0438 \u0442\u043e\u043c, \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 cgi \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u0421 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438(\u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u043b).<\/p>\n<p>  \u041f\u043b\u044e\u0441\u044b: \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430, \u041d\u0438\u0437\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430\u0446\u0438\u044f, \u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c(\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 http, \u043d\u043e \u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 tcp)<br \/>  \u041c\u0438\u043d\u0443\u0441\u044b: \u0421\u044b\u0440\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u044f\u0437\u044b\u043a\u0430, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e<\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0432\u043f\u043e\u043b\u043d\u0435 \u043d\u0435\u043f\u043b\u043e\u0445 \u0438 \u0443\u0434\u043e\u0431\u0435\u043d. \u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0434\u0443\u043c\u0430\u044e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442 GO,node.js.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/181548\/\"> http:\/\/habrahabr.ru\/post\/181548\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-181548","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/181548","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=181548"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/181548\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=181548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=181548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=181548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}