figwheel

general discussion about figwheel, specific discussions in #figwheel-main and #lein-figwheel
2018-08-02T10:44:59.000060Z

iM trying to get figwhell main to run with own server however keep getting this error.

2018-08-02T10:45:01.000215Z

figwheel-main.edn is valid! Unable to find :ring-handler

2018-08-02T10:46:44.000017Z

Ive tryed ring-handler in figwheel-main-edn as well as meta in dev.cljs.edn but same result. IS there any special options I need to get figwheel to compile clojure code aka server.clj?

bhauman 2018-08-02T13:23:09.000048Z

@gas the ring-handler needs to be on the classpath

2018-08-02T19:27:19.000256Z

yeah it is. its name is server.clj under same directory as the .cljs files. hmm mayb my directory has a hyphen in the edn does it need to be _? let me check

2018-08-02T19:33:13.000037Z

nope 😞 src ├── clj │ └── config_manager │ └── server.clj └── cljs └── config_manager ├── config.cljs ├── core.cljs ├── db.cljs ├── events.cljs ├── subs.cljs └── views.cljs figwheel_main {:log-syntax-error-style :concise :ring-handler config-manager.server/handler}

bhauman 2018-08-02T19:33:49.000355Z

@gas I'd need more details

bhauman 2018-08-02T19:34:01.000333Z

what is your classpath?

bhauman 2018-08-02T19:34:16.000129Z

is src/clj on your classpath?

2018-08-02T19:34:23.000288Z

deps.edn :paths [“src/cljs” “src/clj” “target” “resources”]

bhauman 2018-08-02T19:35:21.000469Z

well that's odd

2018-08-02T19:36:02.000118Z

tryed with .clj in same directory as .cljs as well - yeah I have been basically just doing tutorial then moved onto your documentation

bhauman 2018-08-02T19:36:56.000084Z

and the error is not found?

2018-08-02T19:37:00.000176Z

any command I should run? clojure -R:dev -A:fig -b dev -r 22:45:29 [Figwheel] Validating figwheel-main.edn [Figwheel] figwheel-main.edn is valid! Unable to find :ring-handler

bhauman 2018-08-02T19:38:20.000025Z

can I see the contents of your server file?

bhauman 2018-08-02T19:38:36.000161Z

because this can happen if there is an error in the file

bhauman 2018-08-02T19:38:53.000192Z

@gas ^

bhauman 2018-08-02T19:39:25.000217Z

that is probably what is happening

2018-08-02T19:40:36.000118Z

sure been trying heaps of things out (ns config-manager.server (:require [http://clojure.java.io :as io] [bidi.ring :refer (make-handler)] [ring.util.response :as res] [compojure.core :refer :all] [compojure.route :as route] [ring.middleware.reload :refer [wrap-reload]] [ring.middleware.defaults :refer [wrap-defaults site-defaults]])) ;; define index content (def home “<!DOCTYPE html> <html> <head> <meta charset=\“UTF-8\“> <meta name=\“viewport\” content=\“width=device-width, initial-scale=1\“> <link href=\“css/style.css\” rel=\“stylesheet\” type=\“text/css\“> <link rel=\“icon\” href=\“https://clojurescript.org/images/cljs-logo-icon-32.png\“&gt; </head> <body> <div id=\“app\“></div> <script src=\“/cljs-out/dev-main.js\” type=\“text/javascript\“></script> </body> </html>“) (defn handler2 [request] (if (and (= :get (:method request)) (= “/” (:uri request))) {:status 200 :headers {“Content-Type” “text/html”} :body home}} {:status 404 :headers {“Content-Type” “text/plain”} :body “Not Found”})) (defn index-handler [request] (res/response home)) (defn json-handler [request] (res/response (slurp (io/resource “public/dev.json”)) )) (def handler (make-handler [“/” {“index.html” index-handler “devq/” json-handler}])) (defroutes app-routes ;; NOTE: this will deliver all of your assets from the public directory ;; of resources i.e. resources/public (route/resources “/” {:root “public”}) ;; NOTE: this will deliver your index.html (GET “/” [] (-> (res/resource-response “index.html” {:root “public”}) (res/content-type “text/html”))) (GET “/json” [] json-handler) (route/not-found “Not Found”)) ;; NOTE: wrap reload isn’t needed when the clj sources are watched by figwheel ;; but it’s very good to know about (def dev-app (wrap-reload (wrap-defaults #’app-routes site-defaults)))

bhauman 2018-08-02T19:41:04.000074Z

so here is what I would do

2018-08-02T19:41:21.000320Z

but pretty sure it didnt work on your one but can retry with that

bhauman 2018-08-02T19:41:33.000316Z

try this

bhauman 2018-08-02T19:41:48.000075Z

start a REPL with clj

bhauman 2018-08-02T19:42:42.000435Z

and then (load "src/clj/config_manager/server.clj")

bhauman 2018-08-02T19:43:03.000226Z

I think you just have a problem in your file

bhauman 2018-08-02T19:43:51.000157Z

I'm going to record an issue that there needs to be feedback if there is an error when loading the file

bhauman 2018-08-02T19:45:16.000411Z

https://github.com/bhauman/figwheel-main/issues/38

bhauman 2018-08-02T19:45:28.000310Z

and I'm going to check that it works myself

2018-08-02T19:46:31.000025Z

quick? how to you do lein clean with clj? clojure -R:dev -A:fig -r 07:31:28 [Figwheel] Validating figwheel-main.edn [Figwheel] figwheel-main.edn is valid!

bhauman 2018-08-02T19:46:45.000443Z

rm -rf target/public

bhauman 2018-08-02T19:47:52.000266Z

btw there is a #figwheel-main channel

bhauman 2018-08-02T19:49:02.000277Z

yeah there is a bug in my server as well

bhauman 2018-08-02T19:49:06.000001Z

in the docs

2018-08-02T19:49:19.000364Z

oh didnt know that looks like I have prob with some other file as keep getting same error

bhauman 2018-08-02T19:52:17.000413Z

oh lots of errors in that example

2018-08-02T19:54:01.000115Z

must be my deps file Im thinking. I dont need to add dependecies devtools, ring as you pull them in for lein? Ill move to figwheel-main

bhauman 2018-08-02T19:54:34.000235Z

@gas I'm not understanding what you are saying

bhauman 2018-08-02T19:56:07.000050Z

did you try my suggestion above? to load the file?

2018-08-02T19:57:31.000207Z

cant get past the above error i.e something screwy with my setup just seen that emacs hadnt created directory - so not sure what is going on at present.

bhauman 2018-08-02T19:58:25.000004Z

OK now I'm having trouble loading the ring-handler

bhauman 2018-08-02T19:58:44.000129Z

So I guess this is a bug

bhauman 2018-08-02T20:03:25.000393Z

yeah somethings not working

bhauman 2018-08-02T20:04:07.000016Z

I'm going to go eat and then come back to this

2018-08-02T20:06:27.000378Z

OK - good Ive just woke up so will have breakfast 🙂 - and Ill go on main

2018-08-02T20:14:03.000117Z

ClojureScript 1.10.339
cljs.user=&gt; (load "src/clj/config_manager/server.clj")
Compile Exception:

bhauman 2018-08-02T20:14:36.000098Z

actually (load "config_manager/server")

2018-08-02T20:18:38.000291Z

same error - and now using your server.clj