title: Passing CSRF token to REACT/FLUX from node
body: <p>I'm using nodejs and usually pass down csrf token like the following:</p>
  
  <p>util.js</p>
  
  <pre><code>module.exports.csrf = function csrf(req, res, next){
       res.locals.token = req.csrfToken();
       next();
  ￼￼};
  </code></pre>
  
  <p>app.js</p>
  
  <pre><code>app.use(csrf());
  app.use(util.csrf);
  </code></pre>
  
  <p>and then in the ejs page I would do </p>
  
  <pre><code>&lt;input type="hidden" name="_csrf" value="&lt;%= token %&gt;"&gt;
  </code></pre>
  
  <p>However, now I'm using flux/react for my front end and need to pass a csrf token for a form submission and not to sure how to do this. There was a similar answer here using jade: </p>
  
  <p><a href="https://stackoverflow.com/questions/11200068/how-to-implement-csrf-protection-in-ajax-calls-using-express-js-looking-for-com">How to implement CSRF protection in Ajax calls using express.js (looking for complete example)?</a></p>
  
  <p>However, I'm using ejs (with jsx)(or just html) and don't want to use jade</p>