Fork me on GitHub
#reitit
<
2020-07-23
>
ikitommi07:07:28

@dharrigan with spec:

(s/def ::datetime (st/spec {:spec ISO8601, :swagger/format "date-time"}))
with malli:
(def DateTime [:re {:swagger/format "date-time"} ISO8601])

dharrigan07:07:58

ooh, thank you. will try - Malli is looking really good!

baptiste-from-paris09:07:47

Hello folks, I am new to reitit and I can’t make static files working, any idea what I am doing wrong ?

(def router
  (rr/router
   ["/" {:get handler}]
   ["/assets/*" (rr/create-resource-handler {:path "resources/public"})]))
when I (r/match-by-path router "/assets/main.css") with main.css in the resources/public/ folder, nothing is found

baptiste-from-paris10:07:53

*edit : I am just stupid as fuck

baptiste-from-paris10:07:23

(def router
  (rr/router
   [["/" {:get handler}]
    ["/assets/*" (rr/create-resource-handler)]]))

baptiste-from-paris10:07:34

forgot the [] wrapper

Alex Ragone13:07:42

Hi all 👋 How do I make a route like the following?

/users           ;; GET POST
/users/:id       ;; GET POST PUT DELETE
I keep getting Too many redirects when calling GET on the /users route. It is defined as follows:
["/users"
   ["" {:get get-users
        :post save-user}]
   ["/:id" {:get get-user
            :put update-user 
            :delete delete-user}]]

Alex Ragone13:07:08

Hm, somehow it is working after I call POST first? :thinking_face:

ikitommi13:07:14

sounds like a bug in redirect-trailing-slash-handler.

ikitommi13:07:59

actually, no. it should always match the first route with /users .

Alex Ragone13:07:02

Somehow I can’t replicate it anymore? Could it be that the browser was caching the status code? :thinking_face: I’ll investigate further and create an issue if necessary. Thanks @ikitommi.

👍 3
dharrigan13:07:56

migrated to using malli - lovely 🙂

dharrigan13:07:02

one thing that caught me out, and if you're using swagger and enums, you have to specify the type directly, otherwise it wont' render the list of valid choices on the swagger ui, i.e., [:enum {:swagger/type "enum"}.....]

ikitommi13:07:43

PR most welcome on that.

dharrigan14:07:51

PR ready for you 🙂