title: Using Gorilla Mux endpoint to stream data via HTTP
body: <p>After receiving a request on my REST endpoint, I would like to reply with status <code>200</code> and a body of data that is continuously generated and flushed (fetched from DB and can be very large). I'm looking for an effective way to do so with <a href="https://github.com/gorilla/mux" rel="nofollow noreferrer">Gorilla Mux</a>, since it's used all over the project.</p>
  
  <p>I saw that it is possible with <a href="https://github.com/labstack/echo" rel="nofollow noreferrer">Labstack Echo</a>, since it's <code>ResponseWriter</code> <a href="https://github.com/labstack/echo/blob/a028fd41fd30390b0e3e8f043c9893b9ea048b5d/response.go#L85" rel="nofollow noreferrer">supports</a> <code>http.Flusher</code> (<a href="https://golang.org/pkg/net/http/#Flusher" rel="nofollow noreferrer">interface</a> to allow an HTTP handler to flush buffered data to the client). Unfortunately, it seems that gorilla's <code>ResponseWriter</code> does not support this.</p>
  
  <hr>
  
  <p>Questions:</p>
  
  <ul>
  <li>Is there a way to have this behaviour with Gorilla Mux?</li>
  <li>If not, I'd appreciate a pointer to the 'slimmest' method to achieve this behaviour otherwise (I already found Labstack Echo, but perhaps there's a better method?)</li>
  </ul>
  
  <p>Invariants:</p>
  
  <ul>
  <li>I cannot use <code>WebSockets</code> and should integrate the solution with the REST APIs.</li>
  <li>I will not be able to hold the entire file in the servers memory.</li>
  </ul>