Add simple static file server

This commit is contained in:
heyarne 2020-05-03 14:11:18 +02:00
commit 5241cae418
4 changed files with 30 additions and 848 deletions

View file

@ -0,0 +1,24 @@
(ns heyarne.all-my-friends.server
(:require [org.httpkit.server :as http]
[compojure.core :as router]
[compojure.route :as route])
#_(:gen-class))
(router/defroutes app
#_(router/GET "/" []
{:status 200
:body "Hello world"})
(route/files "/")
(route/not-found "Not found."))
(defonce server (atom nil))
(defn stop-server []
(when-not (nil? @server)
(@server :timeout 100)
(reset! server nil)))
(defn -main [& args]
(reset! server (http/run-server #'app {:port 8081})))
#_(-main)