{"size": 648, "ext": "js", "max_stars_repo_path": "router/categories/getCategories.js", "max_stars_repo_name": "dt009/blog-server", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "router/categories/getCategories.js", "max_issues_repo_name": "dt009/blog-server", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "router/categories/getCategories.js", "max_forks_repo_name": "dt009/blog-server", "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": 21.6, "max_line_length": 68, "alphanum_fraction": 0.600308642}
/*
 * @Author: duantao-ds
 * @Date: 2018-09-06 11:03:31
 * @Last Modified by: duantao-ds
 * @Last Modified time: 2018-09-08 22:07:17
 */

const Router = require('koa-router');

const router = new Router();

const getCategories = require('../../sql/categories/getCategories');
const resUtil = require('../../utils/res_util');

router.post('/get/allCategories', async ctx => {

    try {
        let selectData = await getCategories();

        if (selectData) {
            ctx.body = resUtil('ok', '获取成功', selectData)
        }

    } catch (error) {
        ctx.body = resUtil('fail', '获取失败', {message: error});
    }
})

module.exports = router;
