Home > Blockchain >  How to know which http server is this Clojure/ClojureScript project using? And how to make the HTTP
How to know which http server is this Clojure/ClojureScript project using? And how to make the HTTP

Time:09-09

I have been using Clojure, ClojureScript, lein, shadow-cljs, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.

Usually, I build the project by executing the command cider-jack-in-cljs in Emacs, choosing shadow-cljs, then shadow for REPL type, and, finally, app for the building option.

It works fine. I can watch changes on the UI on localhost:3005.

Based on this previous question, I would like to understand better which HTTP server I am using.

Doing a git grep, I can find:

Pedros-MacBook-Air:balance pedro$ git grep ":dev-http"
Pedros-MacBook-Air:balance pedro$ git grep ":http"
shadow-cljs.edn:                                 :http-root   "public"
shadow-cljs.edn:                                 :http-port   3005

Hence, I suppose I can conclude the HTTP server is not :dev-http, right?

If so, how can I make :dev-http the default?

Just tweaking shadow-cljs.edn to add :dev-http?

Should I remove current :http-root "public" and :http-port 3005?

CodePudding user response:

:http-root and :http-port in the :devtools part of the build config is the old (and deprecated) style of configuring http servers in shadow-cljs. :dev-http is the new notation.

So your config is identical to setting :dev-http {3005 "public"} (and removing the http parts from :devtools). They are functionally equivalent otherwise.

  • Related