JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

joy/defroutes

joy


    macro
    /usr/local/lib/janet/joy/router.janet on line 319, column 1

    (defroutes & args)


1 exampleSign in to add an example
Loading...
(import joy)

# given a handler
(defn handle-func [request]
  (joy/text/plain (string "Hi " ((request :params) :name))))

# joy/defroutes will prepare routes
(joy/defroutes r [:get "/hi/:name" :handle-func])
# which you can pass to joy/app
(joy/server (joy/app {:routes r}) 9002)
# visit localhost:9002/hi/bob
veqqqPlayground