Skip to content

Instantly share code, notes, and snippets.

Last active April 28, 2018 21:01
What would you like to do?
{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
<!DOCTYPE html>
(ns server
(:require [org.httpkit.server :as httpkit]
[ring.util.response :refer [response]]
[reitit.core :as r]
[reitit.ring :as ring]))
(def reitit-app
[["/" {:get (fn [_] (response (slurp "public/index.html")))}]])
(ring/create-resource-handler {:path "/"})
(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