Last active
August 29, 2022 02:52
-
-
Save jldoubleu/d2f7d54d49875f0682831c792c31f7bf to your computer and use it in GitHub Desktop.
Small http-kit server using compojure for routing.
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
(defproject client-server "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" | |
:url "https://www.eclipse.org/legal/epl-2.0/"} | |
:dependencies [[org.clojure/clojure "1.10.0"] | |
[compojure "1.6.1"] | |
[http-kit "2.3.0"]] | |
:main ^:skip-aot client-server.core | |
:target-path "target/%s" | |
:profiles {:uberjar {:aot :all}}) |
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 client-server.core | |
(:require [org.httpkit.server :as server] | |
[compojure.core :refer [GET defroutes]]) | |
(:gen-class)) | |
(defn root | |
[req] | |
{:status 200 | |
:body "root"}) | |
(defn testing | |
[req] | |
{:status 200 | |
:body "testing 1...2...3..."}) | |
(defroutes app-routes | |
(GET "/" [] root) | |
(GET "/testing" [] testing)) | |
(defn -main | |
"I don't do a whole lot ... yet." | |
[& args] | |
(server/run-server app-routes {:port 8080})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment