2017-12-03 15:43:40 +00:00
|
|
|
(ns example.server
|
|
|
|
|
(:require [ring.adapter.jetty :as jetty]
|
2018-08-27 06:12:09 +00:00
|
|
|
[ring.middleware.params :as params]
|
|
|
|
|
[reitit.ring.middleware.muuntaja :as muuntaja]
|
|
|
|
|
[muuntaja.core :as m]
|
2018-07-22 13:24:00 +00:00
|
|
|
[reitit.ring.coercion :as coercion]
|
2018-08-27 06:12:09 +00:00
|
|
|
[reitit.ring :as ring]
|
|
|
|
|
[example.plain]
|
2017-12-03 15:43:40 +00:00
|
|
|
[example.dspec]
|
|
|
|
|
[example.schema]
|
|
|
|
|
[example.spec]))
|
|
|
|
|
|
|
|
|
|
(def app
|
|
|
|
|
(ring/ring-handler
|
|
|
|
|
(ring/router
|
2018-08-27 06:12:09 +00:00
|
|
|
[example.plain/routes
|
|
|
|
|
example.schema/routes
|
2017-12-03 15:43:40 +00:00
|
|
|
example.dspec/routes
|
|
|
|
|
example.spec/routes]
|
2018-08-27 06:12:09 +00:00
|
|
|
{:data {:muuntaja m/instance
|
|
|
|
|
:middleware [params/wrap-params
|
|
|
|
|
muuntaja/format-middleware
|
2018-07-22 13:24:00 +00:00
|
|
|
coercion/coerce-exceptions-middleware
|
|
|
|
|
coercion/coerce-request-middleware
|
2018-08-27 06:12:09 +00:00
|
|
|
coercion/coerce-response-middleware]}})
|
|
|
|
|
(ring/create-default-handler)))
|
2017-12-03 15:43:40 +00:00
|
|
|
|
2018-08-27 06:12:09 +00:00
|
|
|
(defn start []
|
|
|
|
|
(jetty/run-jetty #'app {:port 3000, :join? false})
|
2017-12-03 15:43:40 +00:00
|
|
|
(println "server running in port 3000"))
|
|
|
|
|
|
2018-08-27 06:12:09 +00:00
|
|
|
(comment
|
|
|
|
|
(start))
|