Fork me on GitHub
#pedestal
<
2017-04-01
>
bradford06:04:48

Hi! I'm getting an odd error message at compile time:

bradford06:04:30

Invalid token: ::http/routes, which is rather odd. Here's the log and code: http://bit.ly/2oJmQgi

rauh06:04:32

@bradford You should require pedestal with :as http for the keywords to be pedestal namespaced keywords

bradford06:04:48

@rauh That was it! thanks

bradford06:04:28

OK, new prob. I'm getting no response (not a 404), when I POST to localhost:8080/recs. The code's pretty simple, though... any ideas? http://bit.ly/2olEzOr

ddeaguiar14:04:11

@bradford defroutes is considered deprecated. You should use def with the tersre route syntaxt as follows:

;; Terse/Vector-based routes
(def routes
  `[[["/" {:get home-page}
      ^:interceptors [(body-params/body-params) http/html-body]
      ["/about" {:get about-page}]]]])

ddeaguiar14:04:34

Hope this helps

ddeaguiar14:04:56

One other thing, although the example in the table-syntax reference uses route/expand-routes, don’t use it in your route definition

ddeaguiar14:04:09

Pedestal will expand routes for you on start up if it’s default-interceptors fn is called. Which is probably in most cases since I suspect that overriding the default interceptors is less common.

ddeaguiar14:04:25

I’m going to create an issue in the http://Pedestal.io guides about that

ddeaguiar14:04:49

But, you’ll need to explicitly expand routes if you want to create and use a url-for helper in your tests.

ddeaguiar15:04:59

For those interested in auth samples, the geheimtur demo app has been updated to use the latest version of Pedestal. See https://github.com/propan/geheimtur-demo

ddeaguiar15:04:18

Geheimtur has also been updated (https://github.com/propan/geheimtur).