Hacker News new | past | comments | ask | show | jobs | submit login

I can't speak too intelligently about how Sinatra is architected, but here's a bit about how Pakyow handles routing.

A route is just a regex and set of functions (blocks, procs, whatever). When a request comes in, the following things happen:

1. An AppContext instance is created that contains the request's state 2. Route is matched (narrowed by method then match on path) 3. Each function is evaluated within the context

Hooks, etc aren't special things and are just functions at a particular location in the set. This set is built at startup, so there's no object creation to fulfill a request (except the Request/Response/AppContext objects). The routing bits of pakyow (pakyow-core) are very close to the Rack metal.

Aside from routing, nearly everything in Pakyow is middleware. This makes it easy to completely remove (not just disable) components like static file handling, logging, etc.

Hope that helps!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: