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

14 lines
399 B
JavaScript

const couchdb = require("../../db");
const controller = {
fetch: async ctx => {
const clientDatabase = couchdb.db.use(ctx.params.clientId);
ctx.body = await clientDatabase.list({ type: "app" });
},
create: async ctx => {
const clientDatabase = couchdb.db.use(ctx.params.clientId);
ctx.body = await clientDatabase.insert(ctx.request.body);
}
}
module.exports = controller;