Add lots more docs! Start with the readme then head over to the intro.
Rename the middleware so they look nicer when imported:
(require '[tg-clj-server.middleware.me :as me]
(-> handler
me/middleware)
I expect this to be the last breaking change for a while :)
Ensure retries & tg-clj-server.poll/run-server
are cancellable.
This means you can use a future to store your app and then cancel it with future-cancel
.
(defn handler [_]
...)
; Run the server
(def f (future (poll/run-server client handler)))
; Stop the server
(future-cancel f)
See the examples for more.
Allow the store middleware to accept an external atom like so:
(def routes
{"/mycommand" (fn [{:keys [store]}]
{:set-store (assoc store :a 1)})})
(def my-store (atom nil))
(def app
(defaults/make-app {:store/atom my-store}))
(app {...})
@my-store
This is useful when other parts of your application need to access the state.
Be warned that changes made outside of a handler will be overwritten when a handler changes the store.
The initial version with:
- Polling
- Routing
- Middleware
- Defaults
- etc