title: json-server add read-only route with middleware
body: <p>In my json-server setup I'd like to set a read-only route.</p>
  
  <p>So instead of setting that route in the <code>db.json</code> file, I'm using a middleware (named <code>middleware.js</code>):</p>
  
  <pre><code>module.exports = (req, res, next) =&gt; {
    if (req.url === '/authenticate') {
      res.body = {
        some_property: "some_value"
      };
      console.log("triggered!!!");
    }
    next();
  };
  </code></pre>
  
  <p>so I run it giving:</p>
  
  <blockquote>
    <p>json-server --watch db.json --middlewares middleware.js</p>
  </blockquote>
  
  <p>the problem is that, despite the <code>if</code> block is triggered and I can see the <code>console.log</code> message, the body of the response will always be empty.</p>