title: Render each of multiple objects in array with Express in Node.js
body: <p>I have multiple objects in array of locals in my <code>routes</code> and would like to render each at the time.</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>// routes.js
  
  const routes = {
    path: '/posts/:id',
    view: 'posts',
    locals: [
      {
        id: 'how-to-write-short',
        title: 'How to write short',
        description: 'The art of painting a thousand pictures with just a few words',
        date: '23 Mar 2018',
        issue: '1'
      },
      {
        id: 'the-glamour-of-grammar',
        title: 'The glamour of grammar',
        description: 'A guide to the magic and mystery of practical English',
        date: '01 April 2018',
        issue: '2'
      }
    ]
  }
  </code></pre>
  
  <p>Right now, this renders the last objects in array when I visit either link <code>http://localhost:3000/posts/how-to-write-short</code> or <code>http://localhost:3000/posts/the-glamour-of-grammar</code>.</p>
  
  <pre><code>// server.js
  
  const express = require('express')
  const routes = require('./routes')
  
  const app = express()
  
  app.set('views', 'src/pages')
  app.set('view engine', 'js')
  app.engine('js', require('./engine'))
  
  app.get(routes.path, function(req, res) {
      res.render(routes.view, routes.locals)
  })
  
  app.listen(3000)
  </code></pre>
  
  <p>What's a better to render each e.g <code>routes.locals[0]</code>, <code>routes.locals[1]</code>, and ...?</p>