{"size": 730, "ext": "js", "max_stars_repo_path": "lib/routes/api/polls/index.js", "max_stars_repo_name": "pjnovas/go-hackdash", "max_stars_repo_stars_event_min_datetime": "2015-09-01T23:16:04.000Z", "max_stars_repo_stars_event_max_datetime": "2015-09-01T23:16:04.000Z", "max_issues_repo_path": "lib/routes/api/polls/index.js", "max_issues_repo_name": "pjnovas/vote-hackdash", "max_issues_repo_issues_event_min_datetime": "2015-08-29T01:13:53.000Z", "max_issues_repo_issues_event_max_datetime": "2015-08-29T01:13:53.000Z", "max_forks_repo_path": "lib/routes/api/polls/index.js", "max_forks_repo_name": "pjnovas/vote-hackdash", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 24.3333333333, "max_line_length": 113, "alphanum_fraction": 0.6835616438}

import {Router} from 'express';
import {find, findMy, findOne, sendList, sendOne, genToken, create, update, isOwner, remove} from './controller';
import {isAuth} from '../helpers';
import votes from './votes';

/**
 * Create and expose router
 */

const app = Router();
export default app;

/**
 * Define routes
 */

app.get('/', isAuth, findMy, sendList);
app.get('/latest', find, sendList);

app.get('/:tokenOrId', findOne, sendOne);

app.post('/', isAuth, create, sendOne);
app.put('/:tokenOrId', isAuth, findOne, isOwner, update, sendOne);
app.delete('/:tokenOrId', isAuth, findOne, isOwner, remove);

app.post('/:tokenOrId/token', isAuth, findOne, isOwner, genToken, sendOne);

app.use('/:tokenOrId/votes', findOne, votes);
