-
Notifications
You must be signed in to change notification settings - Fork 67
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
[WIP] New router #215
base: master
Are you sure you want to change the base?
[WIP] New router #215
Changes from all commits
4b61600
e234424
76f00fe
bcb5dec
ad504e5
891ab2f
c29bb9b
9dad5ad
1bef65d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
type 'a t | ||
type t | ||
|
||
val m : Rock.Handler.t t -> Rock.Middleware.t | ||
val empty : 'action t | ||
val add : 'a t -> route:Route.t -> meth:Method.t -> action:'a -> 'a t | ||
val m : t -> Rock.Middleware.t | ||
val empty : t | ||
val add : t -> route:Router.Route.t -> meth:Method.t -> action:Rock.Handler.t -> t | ||
val param : Request.t -> string -> string | ||
val splat : Request.t -> string list |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
module Private : sig | ||
module Router : module type of struct | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recall that the simplest form omitted some type equalities for types inside |
||
include Router | ||
end | ||
end | ||
|
||
module Context = Context | ||
module Headers = Headers | ||
module Cookie = Cookie | ||
|
@@ -8,14 +14,14 @@ module Body = Body | |
module Request = Request | ||
module Response = Response | ||
module App = App | ||
module Route = Route | ||
module Auth = Auth | ||
module Route = Router.Route | ||
|
||
module Router : sig | ||
type 'action t | ||
type t | ||
|
||
val empty : 'action t | ||
val add : 'a t -> route:Route.t -> meth:Method.t -> action:'a -> 'a t | ||
val empty : t | ||
val add : t -> route:Route.t -> meth:Method.t -> action:Rock.Handler.t -> t | ||
val param : Request.t -> string -> string | ||
val splat : Request.t -> string list | ||
end | ||
|
@@ -88,7 +94,7 @@ module Middleware : sig | |
|
||
will redirect any URI containing two segments with the last segment containing | ||
"hello" to the handler defined in [Handler.hello_world]. *) | ||
val router : Rock.Handler.t Router.t -> Rock.Middleware.t | ||
val router : Router.t -> Rock.Middleware.t | ||
|
||
(** {3 [debugger]} *) | ||
|
||
|
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any guidelines on naming conventions for similar functions in Opium? I assume
m
is "middleware", but would be good to know if this should be used more generally.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's my original naming convention for a module that provides a middleware. It seemed a little long to name things like
Middleware_foo.middleware
. Not so sure if this convention is still beneficial.