title: Read contents of express route
body: <p>does anyone know of a way I can read the contents of my express route? For example, suppose I have a route like:</p>
  
  <pre><code>router.post('/test', (req, res) =&gt; {
    let postBody = {
      firstName: {
        required: true,
        description: "First Name"
      },
      lastName: {
        required: true,
        description: "Last Name"
      },
      email: {
        required: true,
        description: "Your email"
      }
    }
  
    res.json({
      msg: "Success"
    })
  
  })
  </code></pre>
  
  <p>My objective is to read the contents of <code>postBody</code> for each route when the app starts.</p>
  
  <p>My <code>app.js</code>:</p>
  
  <pre><code>import express from 'express'
  
  const router = express.Router()
  const app = express()
  
  
  app._router.stack.forEach(middleware =&gt; {
    if (middleware.handle &amp;&amp; middleware.handle.stack) {
       middleware.handle.stack.forEach(route =&gt; {
         console.log(route)
       })
    }
  })
  
  app.use(router)
  </code></pre>
  
  <p>Using the above code, I can print out all of my routes. However, I am looking to print out the <code>postBody</code> of each route when the app starts. Can someone help?</p>
  
  <p>Thanks in advance!</p>