With the help of Muuntaja, I’ve written my own Transit encoders for my back-end that can handle Instants and soon UUIDs. What I’m not sure about is how to make the parallel decoders on the front-end, where I’m using re-frame-http-fx for my ajax requests. I lifted the following from @yogthos Luminus, but in that code-base as-transit isn’t actually called anywhere, and I’m not sure where I would use it. How should I setup my transit reading on the front-end so that data I receive over the wire correctly interprets my custom special types (Instant, UUID) into the matching Clojurescript things?
(ns myproject.ajax
(:require [ajax.core :as ajax]
[luminus-transit.time :as time]
[cognitect.transit :as transit]))
(defn as-transit [opts]
(merge {:raw false
:format :transit
:response-format :transit
:reader (transit/reader :json time/time-deserialization-handlers)
:writer (transit/writer :json time/time-serialization-handlers)}
opts))