reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
ikitommi 2020-07-23T07:10:28.332100Z

@dharrigan with spec:

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

dharrigan 2020-07-23T07:35:58.332700Z

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

baptiste-from-paris 2020-07-23T09:41:47.334100Z

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-paris 2020-07-23T10:31:53.334400Z

*edit : I am just stupid as fuck

baptiste-from-paris 2020-07-23T10:32:23.334600Z

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

baptiste-from-paris 2020-07-23T10:32:34.334900Z

forgot the [] wrapper

2020-07-23T13:00:42.336700Z

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}]]

2020-07-23T13:19:08.337400Z

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

ikitommi 2020-07-23T13:27:14.338Z

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

ikitommi 2020-07-23T13:28:59.338700Z

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

2020-07-23T13:31:02.339700Z

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.

πŸ‘ 1
dharrigan 2020-07-23T13:46:56.340300Z

migrated to using malli - lovely πŸ™‚

dharrigan 2020-07-23T13:48:02.341200Z

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"}.....]

ikitommi 2020-07-23T13:55:43.341600Z

PR most welcome on that.

dharrigan 2020-07-23T13:58:57.341800Z

πŸ™‚

dharrigan 2020-07-23T14:46:51.342100Z

PR ready for you πŸ™‚