budibase/packages/server/middleware/controllers/application.js

14 lines
399 B
JavaScript
Raw Normal View History

2020-04-07 18:25:09 +02:00
const couchdb = require("../../db");
const controller = {
fetch: async ctx => {
const clientDatabase = couchdb.db.use(ctx.params.clientId);
ctx.body = await clientDatabase.list({ type: "app" });
},
2020-04-07 18:25:09 +02:00
create: async ctx => {
2020-04-07 18:41:57 +02:00
const clientDatabase = couchdb.db.use(ctx.params.clientId);
2020-04-07 21:34:21 +02:00
ctx.body = await clientDatabase.insert(ctx.request.body);
2020-04-07 18:25:09 +02:00
}
}
module.exports = controller;