middleware on davidchua https://dchua.com/tags/middleware/ Recent content in middleware on davidchua Hugo -- gohugo.io en-us Thu, 19 Jun 2014 00:00:00 +0000 Creating my first Rack Middleware with Rack::ContentLength https://dchua.com/posts/2014-06-19-creating-my-first-rack-middleware/ Thu, 19 Jun 2014 00:00:00 +0000 https://dchua.com/posts/2014-06-19-creating-my-first-rack-middleware/ Yeah, I’m probably pretty slow in the game but I think I’ve finally wrapped my head around all the countless Rack Middlewares out there. The goal of this was to create a response_logger that intercepts the response object on the middleware level and send out a log with the size of the JSON object that it returns for future reference. I first setup Rack::ContentLength, which is a great Middleware that’s available out of the box if you’re on Rails.