/**
 * Controller for handling requests to /task.
 * 
 * @author Andreas Willems
 * @version 12 NOV 2015
 */
var router = require('express').Router();
var task = require('../models/task'); 

router.get('/', function(req, res, next) {
  res.write('Hello, World!');
  res.end();
  
});

/**
 * Handles GET requests to /api/tasks
 * and returns all stored tasks.
 */
router.get('/api/tasks', function(req, res, next) {
  var tasks = task.getAll();
  res.json(tasks);
});

module.exports = router;