Skip to content

URI- and method-based handlers #1

@emiln

Description

@emiln

Handler improvements

Choosing the appropriate handler for a request currently amounts to picking the first one in the handler set. Similarly, adding a new handler is a matter of supplying a single function, taking the request as parameter. Both will need to be changed in order to accomodate URI- and method-based matching.

Current usage:

(add-handler
  (fn [request] "Quality HTML"))

This clearly does not allow matching any URI or method (:post, :get, etc.)

Suggested usage:

(defhandler
  my-handler-name
  "/my/uri" :get
  [request context]
  "Body as a function of request and context.")

Open questions

A few questions remain, however:

  • How are wildcards handled in URIs?
  • How are matched wildcards presented to the handler?
  • How are several URI matches treated (fitness of a handler)?
  • How are handlers with identical URI and method dealt with?

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions