You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are already some feature requests that I can't see a good fit in the current architecture as currently jester more looks to me like a demo of fancy nim capabilities rather than full blown (micro) framework, even though we're using it in production =). The following architecture suggestion will make jester much more flexible, extensible and reusable IMO:
Do a Router class which is essentially a mapper_and_dispatcher of Requests to Handlers with smth like the following interface:
procadd*(router: Router, method: HttpMethod|string, urlPattern: string, callback: proc(r: Request): Future[void]) # adds handler to the pool. Lowest-level variantprocremove*(router: Router, method: HttpMethod|string, urlPattern: string) # Removes the handlerprocdispatch*(router: Router, request: Request) {.async.}
The other higher-level bits of API should now be trivial to implement on top of that.
Overall this would allow using the router (which is IMO the key part of jester) in a custom server, split handlers across files and routers, use several routers per single server, create authentication/session handlers and similar request preprocessors/postprocessors, etc.
Does it make sense?
The text was updated successfully, but these errors were encountered:
yglukhov
changed the title
Revisit jester architecture: expose router class
[RFC] Revisit jester architecture: expose router class
Jan 27, 2017
There are already some feature requests that I can't see a good fit in the current architecture as currently jester more looks to me like a demo of fancy nim capabilities rather than full blown (micro) framework, even though we're using it in production =). The following architecture suggestion will make jester much more flexible, extensible and reusable IMO:
Do a
Router
class which is essentially a mapper_and_dispatcher ofRequests
toHandlers
with smth like the following interface:The other higher-level bits of API should now be trivial to implement on top of that.
Overall this would allow using the router (which is IMO the key part of jester) in a custom server, split handlers across files and routers, use several routers per single server, create authentication/session handlers and similar request preprocessors/postprocessors, etc.
Does it make sense?
The text was updated successfully, but these errors were encountered: