0

私はノワールを使っています。

持つ:

(defpage "/welcome" [] "Welcome to Noir!")

私はこれらの両方の URL が機能するようにします。

http://localhost:8080/welcome 
http://localhost:8080/welcome/

ありがとう!

編集:これが完全な答えです。

server.clj、合計します(:use [ring.util.response :only [redirect]])

次に書く:

(defn wrap-slash 
  ""
  [handler]
  (fn [{:keys [uri] :as req}]
    (if (and (.endsWith uri "/") (not= uri "/"))
      (handler (assoc req :uri (.substring uri
                                0 (dec (count uri)))))
      (handler req))))

(server/add-middleware wrap-slash)
4

1 に答える 1