What would be a good approach to (rarely) upload a pdf from a fulcro app to the server when I use fulcro-websocket remote? The upload-file namespace needs http-remote. Are there writers to serialize and where would I plug them in and what format would make sense? Or do I register a second remote as http-remote to the same server for uploads since uploads will happen only rarely?
@magra I'd go for the second option, you could use the examples for a file upload remote and not have to adjust it much.
Has anyone had any success using https://github.com/cemerick/friend w/ http-kit and fulcro3?
We chose buddy, and we're happy with it
@tvaughan do you have it thread in the middleware or where did you place it? Iām looking at some of their examples and trying to figure out where it would fit
(defn- auth-required?
[segment]
;; `accounts` and `static` are used to render the signin page, and `sessions`
;; is the API endpoint used to authenticate users and create sessions.
(not-in? segment ["accounts" "static" "sessions"]))
(defn- check-auth-required
[handler]
(fn [request]
(let [segment (nth (str/split (:uri request) #"/" 3) 1)]
(if (and (auth-required? segment) (not (authenticated? request)))
(if (in? segment ["api" "static"])
(response/unauthorized)
(response/found (urls/route->url (dr/path-to ui/SignIn))))
(handler request)))))
(defonce ^:private session-auth-backend (backends/session))
(defn wrap-check-auth-required
[handler {:keys [session-secret]}]
(-> handler
check-auth-required
(wrap-authentication session-auth-backend)
(wrap-session {:store (cookie-store {:key (s->bytes session-secret)})
:cookie-attrs {:http-only true :same-site :strict}})))
middelware
thanks @tvaughan
No problem. I hope it's helpful