This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:deps | |
{org.clojure/clojure {:mvn/version "1.10.0-alpha4"} | |
ring/ring-core {:mvn/version "1.6.3"} | |
metosin/reitit-core {:mvn/version "0.1.1-SNAPSHOT"} | |
metosin/reitit-ring {:mvn/version "0.1.1-SNAPSHOT"} | |
http-kit {:mvn/version "2.2.0"}}} | |
;; | |
;;├── deps.edn | |
;;├── public | |
;;│ └── index.html | |
;;└── src | |
;; └── server.clj | |
;; Run with: | |
;; clj -m server | |
;; http://localhost:5000 | |
;; this returns 404 | |
;; http://localhost:5000/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>Hello</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns server | |
(:require [org.httpkit.server :as httpkit] | |
[ring.util.response :refer [response]] | |
[reitit.core :as r] | |
[reitit.ring :as ring])) | |
(def reitit-app | |
(ring/ring-handler | |
(ring/router | |
[["/" {:get (fn [_] (response (slurp "public/index.html")))}]]) | |
(ring/routes | |
(ring/create-resource-handler {:path "/"}) | |
(ring/create-default-handler)))) | |
(defn -main [] | |
(httpkit/run-server reitit-app {:port 5000}) | |
(println "started.")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment