title: returning rendered markdown with express and marked
body: <p>So I am running a small test application to return the contents of a markdown file in html when a route is visited. I am using marked to render the markdown (<a href="https://github.com/chjj/marked" rel="noreferrer">https://github.com/chjj/marked</a>).</p>
  
  <p>Here us what I have so far - </p>
  
  <pre><code>app.get('/test', function(req, res) {
    var path = __dirname + '/markdown/test.md'
    var file = fs.readFile(path, 'utf8', function(err, data) {
      if(err) {
        console.log(err)
      }
      return data.toString()
    })
    res.send(marked(file))
  })
  </code></pre>
  
  <p>When I navigate to localhost:3000 I'm getting  - </p>
  
  <p>TypeError: Cannot call method 'replace' of undefined
  Please report this to <a href="https://github.com/chij/marked" rel="noreferrer">https://github.com/chij/marked</a>.</p>
  
  <p>I'm fairly certain I'm trying to send a string, and it res.send('Hello World!') works just fine. Sorry I'm new to both Node and express so I'm still figuring things out. Any help is much appreciated.</p>