Serving index.html file from compojure

Viewed 906

I'm new to clojure and compojure and trying out the compojure along with ring to create a basic web application.

here is my handler.clj

(ns gitrepos.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.util.response :as resp]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

(defroutes app-routes
  (GET "/" [] (resp/file-response "index.html" {:root "public"}))
  (route/not-found "Not Found"))

(def app
  (wrap-defaults app-routes site-defaults))

i have this index.html file under /resources/public but the application is not rendering this html file. Instead getting Not found

I have searched a lot it, even this Serve index.html at / by default in Compojure does not seems to resolve the issue.

Not sure what am i missing here.

3 Answers
Related