Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiccup-style syntax for routing #21

Open
ikitommi opened this issue Feb 18, 2016 · 0 comments
Open

Hiccup-style syntax for routing #21

ikitommi opened this issue Feb 18, 2016 · 0 comments

Comments

@ikitommi
Copy link
Member

Routing with just named namespaces feels good, but using the kekkonen.core/namespace is hairy. We could use the hiccup-syntax instead:

(defn api [{:keys [db]}]
  [:api
   {:interceptors [authenticated]}
   [:public
    'public.api]
   [:process
    (process/generate-handlers db)]
   [:users
    {:interceptors [logged-in]}
    users/add-user
    users/remove-user
    users/list-users
    users/change-password]
   [:admin
    {:roles #{:admin}}
    admin/delete-db]])

which would allow to store the namespaces separately, in spirit of defroutes:

(def user-api
  [:users
   {:interceptors [logged-in]}
   users/add-user
   users/remove-user
   users/list-users
   users/change-password])

(defn api [{:keys [db]}]
  [:api
   {:interceptors [authenticated]}
   [:public
    'public.api]
   [:process
    (process/generate-handlers db)]
   user-api
   [:admin
    {:roles #{:admin}}
    admin/delete-db]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant