var express = require('express');

var router = express.Router();


router.get('/', function(request, response) {
  request.db.get("users").find({}, function(error, document) {
    if (error) console.log(error);
    response.send(document);
  });
});


router.post('/', function(request, response) {
  var username = request.body.username;
  var age = Number(request.body.age);
  var content = {
    "username": username,
    "age": age
  }

  request.db.get("users").insert(content, function(error, document) {
    if (error) {
      response.send("Error");
    }

    response.send("Created");
  });
});


router.get('/:username', function(request, response) {
  var username = request.params.username;

  request.db.get("users").find({'username': username}, function(error, document) {
    if (error) console.log(error);
    response.send(document);
  });
});


module.exports = router;

@@ -858,16 +858,279 @@
 ;%0A%7D);%0A%0A%0A
+router.delete(%22/:username%22, function(request, response) %7B%0A  var username = request.params.username;%0A%0A  request.db.get(%22users%22).remove(%7B'username': username%7D, function(error, document) %7B%0A    if (error) console.log(error);%0A    response.send('Deleted');%0A  %7D);%0A%7D);%0A%0A%0A
 module.e

update users router: add delete functionality