{"id":6383,"date":"2011-10-29T02:01:55","date_gmt":"2011-10-28T17:01:55","guid":{"rendered":"http:\/\/fukata.org\/?p=6383"},"modified":"2017-08-11T22:58:48","modified_gmt":"2017-08-11T22:58:48","slug":"auto-reload-ring-reload-modified","status":"publish","type":"post","link":"https:\/\/blog.fukata.org\/archives\/6383\/","title":{"rendered":"ring-reload-modified\u3067\u81ea\u52d5\u30ea\u30ed\u30fc\u30c9"},"content":{"rendered":"
weavejester\/ring-reload-modified – GitHub<\/a><\/p>\n WEB\u958b\u767a\u3092\u884c\u3063\u3066\u3044\u308b\u3068\u7de8\u96c6\u3057\u305f\u5185\u5bb9\u3092\u3059\u3050\u306b\u78ba\u8a8d\u3057\u305f\u3044\u3067\u3059\u3088\u306d\u3002\u4ee5\u524d\u307e\u3067\u306f\u3001\u7de8\u96c6\u3057\u3066\u306f\u30b5\u30fc\u30d0\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4e00\u5ea6\u505c\u6b62\u3057\u3066\u518d\u5ea6\u8d77\u52d5\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u3092\u3084\u3063\u3066\u304a\u308a\u3001\u6bce\u56de\u624b\u52d5\u3067\u518d\u8d77\u52d5\u51e6\u7406\u3092\u884c\u3046\u306e\u304c\u975e\u5e38\u306b\u9762\u5012\u3067\u3001\u3055\u3089\u306b\u306f\u518d\u8d77\u52d5\u3092\u5fd8\u308c\u3001\u52d5\u4f5c\u78ba\u8a8d\u6642\u306b\u300c\u3042\u308c\uff1f\u300d\u307f\u305f\u3044\u306a\u4e8b\u304c\u305f\u307e\u306b\u3042\u3063\u305f\u306e\u3067\u3001\u89e3\u6c7a\u7b56\u3092\u63a2\u3057\u3066\u3044\u308b\u3068Ring\u306eMiddleware\u3068\u3057\u3066\u4e0a\u8a18\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n \u3053\u308c\u306f\u3001\u6307\u5b9a\u3057\u305f\u30bd\u30fc\u30b9\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306eClojure\u30d5\u30a1\u30a4\u30eb\u304c\u4fee\u6b63\u3055\u308c\u305f\u3089\u30ea\u30ed\u30fc\u30c9\u3057\u3066\u304f\u308c\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\u8a2d\u5b9a\u306f\u7c21\u5358\u3067\u3001\u3053\u3093\u306a\u611f\u3058\u306b\u3057\u307e\u3059\u3002<\/p>\n \u305f\u3060\u3001\u4e00\u3064\u96e3\u70b9\u304c\u3042\u308a\u3001Fleet\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3092\u7de8\u96c6\u3057\u305f\u5834\u5408\u306b\u306f\u5909\u66f4\u3092\u691c\u51fa\u3057\u3066\u304f\u308c\u305a\u3001\u6b63\u5e38\u306b\u5909\u66f4\u3092\u8868\u793a\u3067\u304d\u307e\u305b\u3093\u3002\u307e\u3060\u3001ring-reload-modified\u306e\u30bd\u30fc\u30b9\u3092\u898b\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u3082\u3057\u304b\u3059\u308b\u3068\u7c21\u5358\u306b\u5bfe\u5fdc\u3067\u304d\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n \u3068\u308a\u3042\u3048\u305a\u3001\u8a2d\u5b9a\u65b9\u6cd5\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n <\/p>\n project.clj\u306e:dependencies\u306b weavejester\/ring-reload-modified – GitHub WEB\u958b\u767a\u3092\u884c\u3063\u3066\u3044\u308b\u3068\u7de8\u96c6\u3057\u305f\u5185\u5bb9\u3092\u3059\u3050\u306b\u78ba\u8a8d\u3057\u305f\u3044\u3067\u3059\u3088\u306d\u3002\u4ee5\u524d\u307e\u3067\u306f\u3001\u7de8\u96c6\u3057\u3066\u306f\u30b5\u30fc\u30d0\u30d7\u30ed\u30b0\u30e9\u30e0\u3092 … \u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":9223372036854775807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1980],"tags":[900,907,925],"_links":{"self":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/6383"}],"collection":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/comments?post=6383"}],"version-history":[{"count":0,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/6383\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media\/9223372036854775807"}],"wp:attachment":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media?parent=6383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/categories?post=6383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/tags?post=6383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\u8a2d\u5b9a\u65b9\u6cd5<\/h2>\n
[ring-reload-modified \"0.1.1\"]<\/code>\u3092\u8ffd\u52a0\u5f8c\u3001\u4e0b\u8a18\u306e\u8a2d\u5b9a\u3092\u884c\u3048\u3070\u81ea\u52d5\u30ea\u30ed\u30fc\u30c9\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
\u5909\u66f4\u524d<\/h3>\n
\r\n(ns compojuretest.core\r\n (:use compojure.core\r\n compojure.response\r\n ring.adapter.jetty\r\n [ring.util.response :only (response content-type)]\r\n fleet)\r\n (:require [compojure.route :as route]\r\n [compojure.handler :as handler]))\r\n\r\n;; ... \u7701\u7565 ...\r\n\r\n;; =============================================\r\n;; Routes\r\n;; =============================================\r\n(defroutes app\r\n (GET \"\/\" [] (tpl\/index {})))\r\n\r\n;; =============================================\r\n;; Run Server\r\n;; =============================================\r\n(defn -main []\r\n (let [port (Integer\/parseInt (get (System\/getenv) \"PORT\" \"8080\"))]\r\n (run-jetty (handler\/site app) {:port port})))\r\n<\/pre>\n
\u5909\u66f4\u5f8c<\/h3>\n
\r\n(ns compojuretest.core\r\n (:use compojure.core\r\n compojure.response\r\n ring.adapter.jetty\r\n+ ring.middleware.reload-modified\r\n [ring.util.response :only (response content-type)]\r\n fleet)\r\n (:require [compojure.route :as route]\r\n [compojure.handler :as handler]))\r\n\r\n;; ... \u7701\u7565 ...\r\n\r\n;; =============================================\r\n;; Routes\r\n;; =============================================\r\n(defroutes app\r\n (GET \"\/\" [] (tpl\/index {})))\r\n\r\n;; =============================================\r\n;; Run Server\r\n;; =============================================\r\n+ ;; AutoReload Configuration\r\n+ (def app (handler\/site app))\r\n+ (def handlerApp \r\n+ (wrap-reload-modified #'app [\"src\"]))\r\n\r\n(defn -main []\r\n (let [port (Integer\/parseInt (get (System\/getenv) \"PORT\" \"8080\"))]\r\n- (run-jetty (handler\/site app) {:port port})))\r\n+ (run-jetty handlerApp {:port port})))\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"