Serve index.html at / by default in Compojure

前端 未结 8 1890
无人及你
无人及你 2020-12-28 14:19

I have a static file called index.html that I\'d like to serve when someone requests /. Usually web servers do this by default, but Compojure doesn

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 14:38

    This works just fine. No need to write a ring middle-ware.

    (:require [clojure.java.io :as io])
    
    (defroutes app-routes 
    (GET "/" [] (io/resource "public/index.html")))
    

提交回复
热议问题