{"size": 966, "ext": "js", "max_stars_repo_path": "routes/account.js", "max_stars_repo_name": "rodgars/bigball", "max_stars_repo_stars_event_min_datetime": "2018-06-09T22:50:00.000Z", "max_stars_repo_stars_event_max_datetime": "2018-06-12T23:42:00.000Z", "max_issues_repo_path": "routes/account.js", "max_issues_repo_name": "rodgars/bigball", "max_issues_repo_issues_event_min_datetime": "2018-06-04T22:39:45.000Z", "max_issues_repo_issues_event_max_datetime": "2018-06-29T02:14:32.000Z", "max_forks_repo_path": "routes/account.js", "max_forks_repo_name": "rodgars/bigball", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": 17, "max_forks_count": null, "avg_line_length": 15.3333333333, "max_line_length": 58, "alphanum_fraction": 0.6428571429}
var express = require('express');
var AccountController = require('../controllers/account');

var router = express.Router();
var accountController = new AccountController();

router.get('/', (req, res) => {
	accountController.getAll(function(docs){
		
		res.json(docs);
	});
});

router.get('/:accId', (req, res) => {

	var accId = req.params.accId;

	accountController.getById(accId, function(docs){
		
		res.json(docs);
	});
});


router.delete('/:accId', (req, res) => {
	
	var accId = req.params.accId;

	accountController.delete(accId, function(doc){

		res.json(doc);

	});

});

router.put('/:accId', (req, res) => {

	var accId = req.params.accId;
	var account = req.body;

	accountController.update(accId, account, function(doc){

		res.json(doc);

	});
});

router.post('/', (req, res) => {

	var account = req.body;
	var accId = account._id;

	accountController.update(accId, account, function(doc){

		res.json(doc);

	});
});


module.exports = router;
