{"size": 804, "ext": "js", "max_stars_repo_path": "app/routes.js", "max_stars_repo_name": "pattertj/DeckCheck", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/routes.js", "max_issues_repo_name": "pattertj/DeckCheck", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/routes.js", "max_forks_repo_name": "pattertj/DeckCheck", "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": 29.7777777778, "max_line_length": 140, "alphanum_fraction": 0.4166666667}
var Card = require('./models/card');

module.exports = function (app) {

    app.disable('etag');

    // api ---------------------------------------------------------------------
    // get a card by name
    app.get('/api/cards/:name', function (req, res) {
        var name = '^' + req.params.name + '$';

        Card.findOne({
            'name': {'$regex': name,$options:'i'}
        }, function (err, card) {
            if (err) {
                res.send(err);
            }

            res.json(card);
        })
    });

    // application -------------------------------------------------------------
    app.get('*', function (req, res) {
        res.sendFile(__dirname + '/public/index.html'); // load the single view file (angular will handle the page changes on the front-end)
    });
};