better client id endpoint

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

View File

@ -2,7 +2,8 @@ const couchdb = require("../../db");
const controller = { const controller = {
create: async ctx => { 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(); const router = Router();
router.post("/api/applications/:clientId", controller.create) router.post("/api/:clientId/applications", controller.create)
module.exports = router; module.exports = router;