Skip to content
Permalink
b26de2279c
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
24 lines (15 sloc) 514 Bytes
var Router = require('koa-router');
var adminModel = require('../models/admin');
var router = Router({
prefix: '/api/v1.0/admin'
});
//because we are going to parse POST parameters we will import koa-bodyparser
var bodyParser = require('koa-bodyparser');
router.get('/', (cnx, next)=> {
cnx.body = {message:'Admin area'};
});
router.post('/create_db', async (ctx, next) => {
let item = await adminModel.createTables(ctx.params.id);
ctx.body = item;
});
module.exports = router;