{"size": 1251, "ext": "js", "max_stars_repo_path": "routes/api.js", "max_stars_repo_name": "jamesdraper5/angularapp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "routes/api.js", "max_issues_repo_name": "jamesdraper5/angularapp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "routes/api.js", "max_forks_repo_name": "jamesdraper5/angularapp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.02, "max_line_length": 80, "alphanum_fraction": 0.4940047962}
/**************************************************
 Routes for tables
***************************************************/
var tableEngine = require('../data/tables');

exports.tables = {
	self: this,
	getAllTables: function(req, res) {
	  	var opts = {};
	  	var tableData = tableEngine.getAllTables(req, res, function(req, res, docs){
	  		// Internal error, probably passed incorrect hex value for table id
	  		if ( docs === null ) {
	  			res.status(404).json({
	  				status: 'error',
	  				message: 'Not Found'
	  			})
	  		} else {
	  			res.json(docs);
	  		}
	  	});
	},
	getTableById: function(req, res) {
		var tableData = tableEngine.getTableById(req, res, function(req, res, docs){
	  		// Internal error, probably passed incorrect hex value for table id
	  		if ( docs === null ) {
	  			res.status(404).json({
	  				status: 'error',
	  				message: 'Not Found'
	  			})
	  		} else {
	  			res.json(docs);
	  		}
	  	});
	},
	createEntry: function(req, res) {
		var entry = req.body;
		var tableData = tableEngine.createTableEntry(entry, function(result){
	  		res.json(result);
	  	});
	},


}; 




/**************************************************
 Routes for table entries
***************************************************/