Skip to content

重新加载(Reloading)

YANG YUE edited this page Aug 9, 2016 · 1 revision

当一个源文件被修改后能够在开发中使用后,需要重新加载命名空间.ring-devel库为此提供了中间件.

(ns myapp
  (:require
   [compojure.core :refer [GET defroutes]]
   [ring.middleware.reload :refer [wrap-reload]]))

(defroutes app
  (GET "/" [] "hello world"))

(def reloadable-app
  (wrap-reload app))