title: How do I check Content-Type using ExpressJS?
body: <p>I have a pretty basic RESTful API so far, and my Express app is configured like so:</p>
  
  <pre><code>app.configure(function () {
    app.use(express.static(__dirname + '/public'));
    app.use(express.logger('dev'));
    app.use(express.bodyParser());
  });
  
  app.post('/api/vehicles', vehicles.addVehicle);
  </code></pre>
  
  <p>How/where can I add middleware that stops a request from reaching my <code>app.post</code> and <code>app.get</code> if the content type is not <code>application/json</code>?</p>
  
  <p>The middleware should only stop a request with improper content-type to a url that begins with <code>/api/</code>.</p>