{"id":2273,"date":"2015-06-10T21:10:59","date_gmt":"2015-06-10T12:10:59","guid":{"rendered":"http:\/\/www.whoocus.com\/blog\/?p=2273"},"modified":"2015-06-10T21:20:50","modified_gmt":"2015-06-10T12:20:50","slug":"phoenix%e6%96%b0%e8%a6%8f%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ae%e8%bf%bd%e5%8a%a0","status":"publish","type":"post","link":"https:\/\/www.blowfish.co.jp\/?p=2273","title":{"rendered":"Phoenix\u65b0\u898f\u30da\u30fc\u30b8\u306e\u8ffd\u52a0"},"content":{"rendered":"<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u4f5c\u6210\u3055\u308c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u968e\u5c64\u304c\u751f\u6210\u3055\u308c\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.blowfish.co.jp\/wp-content\/uploads\/2015\/06\/root.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.blowfish.co.jp\/wp-content\/uploads\/2015\/06\/root.png\" alt=\"root\" width=\"597\" height=\"330\" class=\"aligncenter size-full wp-image-2274\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.blowfish.co.jp\/wp-content\/uploads\/2015\/06\/path.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.blowfish.co.jp\/wp-content\/uploads\/2015\/06\/path.png\" alt=\"path\" width=\"262\" height=\"456\" class=\"aligncenter size-full wp-image-2276\" \/><\/a><\/p>\n<p>\u751f\u6210\u3055\u308c\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u53c2\u8003\u306b\u3001http:\/\/localhost:4000\/hello \u3067\u547c\u3076\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3002<br \/>\n\u307e\u305a\u306f\u3001\u30eb\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>    get &#8220;\/hello&#8221;, HelloController, :index<\/p>\n<p>\u3092\u8ffd\u8a18\u3057\u305f\u3002<\/p>\n<p><strong>web\/router.ex<\/strong><br \/>\n[ruby]<br \/>\ndefmodule PhoenixSample.Router do<br \/>\n  use PhoenixSample.Web, :router<\/p>\n<p>  pipeline :browser do<br \/>\n    plug :accepts, [&quot;html&quot;]<br \/>\n    plug :fetch_session<br \/>\n    plug :fetch_flash<br \/>\n    plug :protect_from_forgery<br \/>\n  end<\/p>\n<p>  pipeline :api do<br \/>\n    plug :accepts, [&quot;json&quot;]<br \/>\n  end<\/p>\n<p>  scope &quot;\/&quot;, PhoenixSample do<br \/>\n    pipe_through :browser # Use the default browser stack<\/p>\n<p>    get &quot;\/&quot;, PageController, :index<br \/>\n    get &quot;\/hello&quot;, HelloController, :index<br \/>\n  end<\/p>\n<p>  # Other scopes may use custom stacks.<br \/>\n  # scope &quot;\/api&quot;, PhoenixSample do<br \/>\n  #   pipe_through :api<br \/>\n  # end<br \/>\nend<br \/>\n[\/ruby]<\/p>\n<p>\u6b21\u306b\u3001\u30eb\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u6307\u5b9a\u3057\u305f HelloController \u3092\u4f5c\u6210\u3057\u3066\u307f\u308b\u3002<br \/>\n\u30e1\u30bd\u30c3\u30c9\u306f index \u3068\u3057\u3066\u3001index.html \u3092\u8868\u793a\u3059\u308b\u3088\u3046\u3057\u3066\u3044\u3059\u308b\u3002<\/p>\n<p><strong>web\/controllers\/hello_controller.ex<\/strong><br \/>\n[ruby]<br \/>\ndefmodule PhoenixSample.HelloController do<br \/>\n  use PhoenixSample.Web, :controller<\/p>\n<p>  plug :action<\/p>\n<p>  def index(conn, _params) do<br \/>\n    render conn, &quot;index.html&quot;<br \/>\n  end<br \/>\nend<br \/>\n[\/ruby]<\/p>\n<p>\u5b9f\u969b\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u90e8\u5206\u3002templates\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u540d\u306b\u5bfe\u5fdc\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u914d\u7f6e\u3059\u308b\u3002<\/p>\n<p><strong>web\/templates\/hello\/index.html.eex<\/strong><br \/>\n[ruby]<br \/>\n&lt;div&gt;\u3053\u3093\u306b\u3061\u306f\u3002\u305f\u3062\u3055\u3093\u3002&lt;\/div&gt;<br \/>\n[\/ruby]<\/p>\n<p>view\u90e8\u5206\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u304c\u3001\u3069\u306e\u3088\u3046\u306a\u30bf\u30b9\u30af\u3092\u53f8\u3063\u3066\u3044\u308b\u306e\u304b\u4e0d\u660e\u3002<br \/>\n\u305d\u306e\u3046\u3061\u8abf\u3079\u3066\u307f\u308b\u3002<\/p>\n<p><strong>web\/views\/hello_view.ex<\/strong><br \/>\n[ruby]<br \/>\ndefmodule PhoenixSample.HelloView do<br \/>\n  use PhoenixSample.Web, :view<br \/>\nend<br \/>\n[\/ruby]<\/p>\n<p><a href=\"https:\/\/www.blowfish.co.jp\/wp-content\/uploads\/2015\/06\/view.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.blowfish.co.jp\/wp-content\/uploads\/2015\/06\/view.png\" alt=\"view\" width=\"730\" height=\"276\" class=\"aligncenter size-full wp-image-2280\" \/><\/a><\/p>\n<p>\u4ee5\u4e0a\u3001\u30a2\u30d7\u30ea\u306e\u6982\u8981\u3067\u3042\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u4f5c\u6210\u3055\u308c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u968e\u5c64\u304c\u751f\u6210\u3055\u308c\u305f\u3002 \u751f\u6210\u3055\u308c\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u53c2\u8003\u306b\u3001http:\/\/localhost:4000\/hello \u3067\u547c\u3076\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3002 \u307e\u305a\u306f\u3001\u30eb\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u3066\u307f\u308b\u3002 g [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"footnotes":""},"categories":[53,54,4],"tags":[],"class_list":["post-2273","post","type-post","status-publish","format-standard","hentry","category-elixir","category-phoenix-framework","category-tech"],"_links":{"self":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/2273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2273"}],"version-history":[{"count":4,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/2273\/revisions"}],"predecessor-version":[{"id":2281,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/2273\/revisions\/2281"}],"wp:attachment":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}