Skip to content

Coffee, and possibly horses #14

wants to merge 61 commits into from

5 participants

jcoglan commented Aug 18, 2012

Yeah, so I don't think is really going to scale to meet the growing needs of HorseBook. I need to support 1,000,000 requests per second and the only way you can do this is with a lightweight modern platform like CoffeeScript.

I've ported your framework to Coffee and am already running it in production. Features:

  • Routes based on path and method
  • Sets params to url-encoded body or query string values
  • Before blocks
  • Renders HAML and EJS
  • In-memory sessions
  • Works great with MongoDB

I hope you can see how this is clearly better than doing it in Ruby, which everyone knows isn't a real language.

jcoglan commented Aug 18, 2012

Oh and it supports PATCH which is a real deal-breaker for the Ruby version. Can Ruby even do PATCH, idk?

rkh commented Aug 18, 2012

Nice. Does it support fibers?

arsduo commented Aug 18, 2012

The irony that this is 28 lines largely because you can't use semi-colons in Coffeescript overwhelms me.

jcoglan commented Aug 18, 2012

Fiber support is coming when I rewrite in Fargo.

rkh commented Aug 18, 2012

The irony that this is 28 lines largely because you can't use semi-colons in Coffeescript overwhelms me.

It's 15 lines if you replace semicolons with newlines in the Ruby version.

jcoglan added some commits Aug 19, 2012
@jcoglan jcoglan Allow user to set headers and status codes. 20395a6
@jcoglan jcoglan Make cookies safer. 0759198
@jcoglan jcoglan Remove an unneeded space. e99065e
@jcoglan jcoglan Incorporate map() call into w(). 5ad7a65
@jcoglan jcoglan Respond to HEAD and OPTIONS. b18205d
@jcoglan jcoglan Cleaner params parsing. cb5b527
@jcoglan jcoglan Remove a redundant helper function. c7973a5
@jcoglan jcoglan Remove .rvmrc. a29b940
@jcoglan jcoglan Remove some unneeded parens. 83c7f87
@jcoglan jcoglan Move parens in a helper function. 9359f13
@jcoglan jcoglan Add path-parameter parsing. e8d6c90
@jcoglan jcoglan Don't parse URLs twice. 4cc3c45
@jcoglan jcoglan Make helper functions visible in HAML and EJS. 208f16f
@jcoglan jcoglan Let the user pick a port. a190754
@jcoglan jcoglan Change port variable name. 8698e7b
@jcoglan jcoglan Remove some parens we don't need. 0b2412e
@jcoglan jcoglan Add WebSocket support. efb0304
@jcoglan jcoglan Documentation. aa563b7
@jcoglan jcoglan Add EventSource support. 083c14d
@jcoglan jcoglan Include query string params in WebSocket and EventSource handlers. 31b0235
@jcoglan jcoglan Golf the request-dispatching code a bit. 79e8726
@jcoglan jcoglan Correct Content-Type header in README. 9a69b43
@jcoglan jcoglan Support params.splat. 125926d
@jcoglan jcoglan Pass params into the request handlers as arguments. 2f4b339
@jcoglan jcoglan Lose 4 characters. b374989
@jcoglan jcoglan Highlight code in the readme appropriately. 6bbf935
@jcoglan jcoglan Example code for accessing the session in a WebSocket handler. 305e469
@jcoglan jcoglan Reduce line count by 10. dd04d84
@jcoglan jcoglan Single-letter class names. 86ece34
@jcoglan jcoglan Use self-contained sessions. 0a691f6
@jcoglan jcoglan Correct description of sessions in readme. 95b06b6
@jcoglan jcoglan Make before-filters happen when the request is fully processed, and m…
…ake them async-chained.
@jcoglan jcoglan Use full words @request and @response. 699c133
@jcoglan jcoglan Merge two lines. d06b9c1
@jcoglan jcoglan Shouldn't be a space between args. c23db3c
@jcoglan jcoglan Add cookie support. 92cf012
@jcoglan jcoglan Fix 404 handling. cb807e4
@jcoglan jcoglan Shave a few characters off. e5bc952
@jcoglan jcoglan Serve static files, and render views from files. 41d1fc6
@jcoglan jcoglan Fix readme code formatting. 185820a
@jcoglan jcoglan Merge documentation for sockets. 1795995
@jcoglan jcoglan Commit missing example app. fdc79b8
@jcoglan jcoglan Remove an unneeded route handler from the example app. f9d2ef0
@jcoglan jcoglan Place all the browser-accessible route handlers up top. 5529034
@jcoglan jcoglan Accommodate route matchers with no leading slash, or with a trailing …
@jcoglan jcoglan Add context groups for shorter routes and contextual before-blocks. 8ed84b8
@jcoglan jcoglan Add Content-Length to static file responses, and golf things down a bit. 2806c99
@jcoglan jcoglan Don't allow '..' as a path segment. d79277c
@jcoglan jcoglan Add redirect() method. cc9588d
@jcoglan jcoglan Cookies should go through URI codec on the wire. 8a8b922
@jcoglan jcoglan URI-encode session cookies, otherwise they decode badly. 9bbc67f
@jcoglan jcoglan Make a docs website, change the name of the project. 0b28889
@jcoglan jcoglan CoffeeScript is a dev dependency. 8880e2f
@jcoglan jcoglan Plug Mongo. 839a191
@jcoglan jcoglan Correct documentation of empty OPTIONS reponse. 88463b0
@jcoglan jcoglan Add Analytics tracking. 01aaad3
@jcoglan jcoglan Link to source. e1e134f

Plz provide not obfuscated source code.

There is no non-obfuscated source, Berliner is written directly in that format.

Hmm... You really think this is non-obfuscated source? I have bad news for you...

No, it is deliberately obfuscated. It's a fork of almost-sinatra, the entire point is to make the code as small as possible.

jcoglan commented Aug 1, 2013

@rkh how the heck is this PR still open

rkh commented Aug 1, 2013

Hahaha. Amazing. It's not mergeable anymore, could you maybe rebase?

rkh commented Jul 8, 2014

Still needs a rebase.

jcoglan commented Jul 8, 2014

Nope #sorrynotsorry


@rkh Why can't you just merge it anyway. Don't be such a pedant.

rkh commented Jul 8, 2014


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.