pedestal

ccann 2019-01-31T17:48:55.026600Z

@donaldball you could also set interceptors at the server config level with the key :io.pedestal.http/interceptors with a vector of common interceptors, if that factoring works for your setup

ccann 2019-01-31T17:50:23.027100Z

so my routes looks like this:

(def routes
  #{["/custom/notes"                     :get   [auth    owner    `notes/filter-by-user]]
    ["/custom/notes"                     :post  [auth-un any-user `notes/create-one]]
    ["/custom/notes/:id"                 :get   [auth    owner    `notes/read-one]]
    ["/custom/notes/:id"                 :patch [auth-un owner    `notes/update-one]]
    ["/custom/notes/:id/graphic"         :get   [auth    owner    `notes/read-graphic]]
    ["/custom/notes/:id/production-file" :post  [auth    owner    `notes/create-production-file]]
    ["/custom/health_check"              :get   `healthy]})


(def interceptors
  [(multipart-params)
   (body-params)
   json-body
   authorization
   exception-handler])

ccann 2019-01-31T17:50:53.027800Z

where the interceptors vector is pulled into the server config

caleb.macdonaldblack 2019-01-31T22:49:54.029300Z

I'm trying to access my pedestal service from my web app but the preflight OPTIONS request returns a 404. A GET request to the same url works. I haven't had this issue before when using pedestal in the past. Any ideas what silly little thing I'm missing is?

ccann 2019-01-31T22:55:36.029500Z

could it be a CORS issue?

caleb.macdonaldblack 2019-01-31T22:56:11.030100Z

Actually yeah. I need to provide ::http/allowed-origins

caleb.macdonaldblack 2019-01-31T22:57:06.031Z

I thought it wouldn't be an issue as I'm hosting pedestal on the same domain. But it looks like it won't deal with preflight at all if it doesn't have that key