module.exports = controller =>
  (req, res) => {
    let payload = '';
    res.setHeader('content-type', 'application/json');
    res.writeHead(200);

    req.on('data', chunk => { payload += chunk; });
    req.on('end', () => {
      controller.createTwtt(JSON.parse(payload), twtt => {
        res.write(JSON.stringify(twtt));
        res.end();
      });
    });
  };
