{"id":2790,"date":"2013-10-08T13:11:54","date_gmt":"2013-10-08T04:11:54","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=2790"},"modified":"2018-11-14T16:33:54","modified_gmt":"2018-11-14T07:33:54","slug":"yesod%e5%85%a5%e9%96%80-4-%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%82%e3%82%8c%e3%81%93%e3%82%8c","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2013\/10\/08\/yesod%e5%85%a5%e9%96%80-4-%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%82%e3%82%8c%e3%81%93%e3%82%8c\/","title":{"rendered":"Yesod\u5165\u9580 (4) \u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3042\u308c\u3053\u308c"},"content":{"rendered":"
\u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n
\u4eca\u56de\u306f Yesod \u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u3064\u3044\u3066\u8abf\u3079\u307e\u3059\u3002<\/p>\n
<\/p>\n
Yesod \u306e\u30b5\u30a4\u30c8\uff08\u300cBasics<\/a>\u300d\u3084\u300cRouting and Handlers<\/a>\u300d\uff09\u3092\u8aad\u3080\u3068\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u3064\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n \u4e00\u3064\u76ee\u306f PHP \u3084 ASP \u306e\u3088\u3046\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u3042\u3063\u305f\u3068\u304d\u306b\u500b\u3005\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u76f4\u63a5\u547c\u3073\u51fa\u3055\u308c\u308b\u65b9\u5f0f\u3067\u306f\u306a\u304f\u3001\u5168\u3066\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u4e00\u7b87\u6240\u3067\u53d7\u3051\u53d6\u308a\u3001\u305d\u3053\u304b\u3089\u9069\u5207\u306a Handler \u306b\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u3055\u308c\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n \u4e8c\u3064\u76ee\u306e\u300c\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a18\u8ff0\u304c\u5ba3\u8a00\u7684\u300d\u306b\u3064\u3044\u3066\u306f\u3001\u5b9f\u969b\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u3092\u898b\u3066\u3044\u305f\u3060\u304f\u3068\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n \u3053\u308c\u306f\u300c\/\u300d\u306b GET \u304b POST \u3067\u30a2\u30af\u30bb\u30b9\u3055\u308c\u305f\u5834\u5408\u306b HomeR \u3068\u3044\u3046 Handler \u3092\u547c\u3073\u51fa\u3059\u3001\u3068\u3044\u3046\u8a2d\u5b9a\u3067\u3059\u3002Web \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u4e2d\u306b\u306f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u3092 XML \u306a\u3069\u3067\u8a18\u8ff0\u3059\u308b\u3082\u306e\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u306e\u3088\u3046\u306a\u3082\u306e\u3068\u6bd4\u8f03\u3059\u308b\u3068\u3001\u8aad\u307f\u3084\u3059\u304f\u3001\u66f8\u304d\u3084\u3059\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n \u5ba3\u8a00\u7684\u306b\u66f8\u304b\u308c\u305f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u70b9\u306b Haskell \u306e\u30b3\u30fc\u30c9\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u30e1\u30bf\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u3088\u3063\u3066\u30b3\u30fc\u30c9\u751f\u6210\u304c\u884c\u308f\u308c\u307e\u3059\u3002<\/p>\n \u4e09\u3064\u76ee\u306f\u4fbf\u5229\u3055\u3068\u9593\u9055\u3044\u3084\u3059\u3055\u306e\u30c8\u30ec\u30fc\u30c9\u30aa\u30d5\u3067\u3001\u305d\u306e\u3088\u3046\u306a\u6c7a\u5b9a\u304c\u884c\u308f\u308c\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n \u6b63\u898f\u8868\u73fe\u3092\u7528\u3044\u308b\u3068\u8a18\u8ff0\u304c\u697d\u306b\u306a\u308b\u5834\u5408\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u4e00\u65b9\u3067\u610f\u56f3\u3057\u306a\u3044\u30d1\u30bf\u30fc\u30f3\u306b\u30de\u30c3\u30c1\u3057\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u30ea\u30b9\u30af\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n \u6b63\u898f\u8868\u73fe\u3092\u4f7f\u308f\u306a\u3051\u308c\u3070\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a18\u8ff0\u91cf\u304c\u5897\u3048\u308b\u5834\u5408\u304c\u3042\u308b\u3082\u306e\u306e\u3001\u305d\u306e\u3088\u3046\u306a\u30ea\u30b9\u30af\u306f\u7121\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n \u3069\u3061\u3089\u3082\u4e00\u9577\u4e00\u77ed\u3067\u3059\u304c\u3001Yesod \u3067\u306f URL \u3068 Handler \u3092\u4e00\u5bfe\u4e00\u3067\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n Yesod \u306f URL \u306b\u306f\u300c\u6b63\u898f\u306e URL (canonical URL)\u300d\u304c\u3042\u308b\u3068\u8003\u3048\u307e\u3059\u3002<\/p>\n \u300c\u6b63\u898f\u306e URL\u300d\u3068\u306f\u4ee5\u4e0b\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3059 URL \u3067\u3059\u3002<\/p>\n \u3082\u3057\u6b63\u898f\u3067\u306f\u306a\u3044 URL \u306b\u30a2\u30af\u30bb\u30b9\u3055\u308c\u308b\u3068\u3001Yesod \u306f\u6b63\u898f\u306e URL \u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u307e\u3059\u3002<\/p>\n \u3064\u307e\u308a\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u307e\u3059\u3002<\/p>\n \u3053\u306e\u3088\u3046\u306a\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3092\u81ea\u52d5\u7684\u306b\u884c\u3046\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306f\u521d\u3081\u3066\u3060\u3063\u305f\u306e\u3067\u3001\u5c11\u3057\u9a5a\u304d\u307e\u3057\u305f\u3002<\/p>\n <\/p>\n \u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306f config\/routes \u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u305f\u76f4\u5f8c\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5185\u5bb9\u304c\u8a18\u8ff0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n \u5148\u307b\u3069 \u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306f\u5ba3\u8a00\u7684\u306b\u8a18\u8ff0\u3067\u304d\u308b\u3068\u8ff0\u3079\u307e\u3057\u305f\u304c\u3001\u4e0a\u8a18\u3092\u898b\u308c\u3070\u5927\u4f53\u306e\u5185\u5bb9\u306f\u4e88\u60f3\u3067\u304d\u307e\u3059\u306d\u3002<\/p>\n \u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u66f8\u304d\u65b9\u306f\u300cURL\u306e\u30d1\u30b9\u300d\u300cHandler\u300d\u300cHTTP\u306e\u30e1\u30bd\u30c3\u30c9\u300d\u3092\u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3067\u8a18\u8ff0\u3059\u308c\u3070\u826f\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n 1 \u884c\u76ee\u306e\u300c\/static StaticR Static getStatic\u300d\u306f\u3053\u306e\u30eb\u30fc\u30eb\u304b\u3089\u5916\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u30b5\u30d6\u30b5\u30a4\u30c8\u3068\u3044\u3046\u3082\u306e\u3092\u6271\u3046\u66f8\u304d\u65b9\u306e\u3088\u3046\u3067\u3059\u3002\u30b5\u30d6\u30b5\u30a4\u30c8\u306b\u3064\u3044\u3066\u306f\u6df1\u5165\u308a\u305b\u305a\u306b\u3001\u3053\u3053\u3067\u306f static \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u53c2\u7167\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3068\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n 3, 4 \u884c\u76ee\u306f\u305d\u308c\u305e\u308c config \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308b favicon.ico \u3068 robots.txt \u3078\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3067\u3059\u3002<\/p>\n 6 \u884c\u76ee\u306f Handler\/Home.hs \u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b HomeR \u3078\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u3067\u3059\u3002\u300c\/\u300d\u3078\u306e GET \u307e\u305f\u306f POST \u3067\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306f HomeR \u306b\u30c7\u30a3\u30b9\u30d1\u30c3\u30c1\u3055\u308c\u307e\u3059\u3002<\/p>\n URL \u30d1\u30b9\u306e\u4e00\u90e8\u3092\u4ed8\u52a0\u7684\u306a\u60c5\u5831\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n \u4e0a\u8a18\u306e\u3088\u3046\u306b\u30c7\u30fc\u30bf\u578b\u306e\u524d\u306b\u300c#\u300d\u3092\u4ed8\u3051\u308b\u3053\u3068\u3067\u3001URL \u30d1\u30b9\u306e\u4e00\u90e8\u3092\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u578b\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n Handler \u3067\u306f\u95a2\u6570\u306e\u5f15\u6570\uff08message\uff09\u3068\u3057\u3066\u5024\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n URL \u30d1\u30b9\u304b\u3089\u53d7\u3051\u53d6\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53ef\u5909\u500b\u306b\u3057\u305f\u3044\u5834\u5408\u306f\u300c#\u300d\u3067\u306f\u306a\u304f\u300c*\u300d\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n \u3053\u306e\u5834\u5408\u306f Handler \u3067\u306f\u6b21\u306e\u3088\u3046\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002<\/p>\n \u3053\u306e\u65b9\u6cd5\u3092\u4f7f\u3048\u3070\u300c\/echo\/aaa\u300d\u306b\u3082\u300c\/echo\/aaa\/bbb\u300d\u306b\u3082\u30de\u30c3\u30c1\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001Wiki \u306e\u3088\u3046\u306a CMS \u30b5\u30a4\u30c8\u3092\u4f5c\u308b\u3068\u304d\u306a\u3069\u306b\u6d3b\u7528\u3067\u304d\u305d\u3046\u3067\u3059\u3002<\/p>\n <\/p>\n \u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u3064\u3044\u3066\u57fa\u672c\u7684\u306a\u3053\u3068\u306f\u7406\u89e3\u3067\u304d\u305f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n \u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u66f8\u304d\u65b9\u4ee5\u5916\u3067\u306f\u3001\u300c\u6b63\u898f\u306e URL (canonical URL)\u300d\u3068\u3044\u3046\u8003\u3048\u65b9\u304c\u3042\u308b\u3053\u3068\u304c\u30dd\u30a4\u30f3\u30c8\u3060\u3068\u611f\u3058\u307e\u3057\u305f\u3002<\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" \u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n \u4eca\u56de\u306f Yesod \u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u3064\u3044\u3066\u8abf\u3079\u307e\u3059\u3002<\/p>\n \n
Front Controller \u30d1\u30bf\u30fc\u30f3\u3092\u63a1\u7528\u3057\u3066\u3044\u308b<\/h3>\n
\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306f\u5ba3\u8a00\u7684\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/h3>\n
\/ HomeR GET POST<\/pre>\n
URL \u3068 Handler \u3092\u4e00\u5bfe\u4e00\u3067\u8a18\u8ff0\u3059\u308b\uff08\u6b63\u898f\u8868\u73fe\u3092\u7528\u3044\u306a\u3044\uff09<\/h3>\n
\u6b63\u898f\u306e URL (canonical URL) \u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b<\/h3>\n
\n
\n
\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u66f8\u304d\u65b9<\/h2>\n
config\/routes \u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n
\/static StaticR Static getStatic\r\n\r\n\/favicon.ico FaviconR GET\r\n\/robots.txt RobotsR GET\r\n\r\n\/ HomeR GET POST<\/pre>\n
\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306f\u300cURL\u306e\u30d1\u30b9\u300d\u300cHandler\u300d\u300cHTTP\u306e\u30e1\u30bd\u30c3\u30c9\u300d\u306e\u9806\u306b\u66f8\u304f<\/h3>\n
URL \u30d1\u30b9\u306e\u4e00\u90e8\u3092\u4ed8\u52a0\u7684\u306a\u60c5\u5831\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b<\/h3>\n
\/echo\/#String EchoR GET<\/pre>\n
getEchoR :: String -> Handler Html\r\ngetEchoR message = defaultLayout $(widgetFile \"echo\")<\/pre>\n
\/echo\/*Texts EchoR GET<\/pre>\n
getEchoR :: Texts -> Handler Html\r\ngetEchoR messages = defaultLayout $(widgetFile \"echo\")<\/pre>\n
\u307e\u3068\u3081<\/h2>\n
\nYesod \u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u7279\u5fb4
\nYesod \u306e\u30b5\u30a4\u30c8\uff08\u300cBasics\u300d\u3084\u300cRouting and Handlers\u300d\uff09\u3092\u8aad\u3080\u3068\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u3064\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002
\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[102,18,84],"tags":[99,100],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2790"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=2790"}],"version-history":[{"count":1,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2790\/revisions"}],"predecessor-version":[{"id":17909,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2790\/revisions\/17909"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=2790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=2790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=2790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}