better client id endpoint

This commit is contained in:
Martin McKeaveney 2020-04-07 17:41:57 +01:00
parent 00443d9dd6
commit c78b14a68a
2 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,8 @@ const couchdb = require("../../db");
const controller = {
create: async ctx => {
ctx.body = await couchdb.db.create(ctx.request.body.appName);
const clientDatabase = couchdb.db.use(ctx.params.clientId);
ctx.body = await clientDatabase.create(ctx.request.body.appname);
}
}

View File

@ -3,6 +3,6 @@ const controller = require("../../controllers/application");
const router = Router();
router.post("/api/applications/:clientId", controller.create)
router.post("/api/:clientId/applications", controller.create)
module.exports = router;