Can I make a fully non-blocking backend application with http-kit and core.async?

With the async approach you get to send the data to the client when its ready, instead of blocking a thread the whole time its being prepared. For http-kit, you should be using an async handler described in the documentation. After delegating the request to an async handler in a proper way, you can implement … Read more

Compojure routes with different middleware

(defroutes user-routes* (GET “-endpoint1” [] (“USER ENDPOINT 1”)) (GET “-endpoint2” [] (“USER ENDPOINT 1”))) (def user-routes (-> #’user-routes* (wrap-basic-authentication user-auth?))) (defroutes admin-routes* (GET “-endpoint” [] (“ADMIN ENDPOINT”))) (def admin-routes (-> #’admin-routes* (wrap-basic-authentication admin-auth?))) (defroutes main-routes (ANY “*” [] admin-routes) (ANY “*” [] user-routes) This will run the incoming request first through admin-routes and then through … Read more

How do I stop jetty server in clojure?

I usually have a line in my Ring app that looks like the following: (defonce server (run-jetty #’my-app {:port 8080 :join? false})) This prevents locking up the REPL. It also allows me to recompile this file without worrying that my server will get redefined. It also lets you interact at the REPL like so: user=> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)