1
0
Fork 0
mirror of synced 2024-06-21 11:51:00 +12:00
budibase/packages/server/middleware/controllers/application.js

14 lines
399 B
JavaScript
Raw Normal View History

2020-04-08 04:25:09 +12: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-08 04:25:09 +12:00
create: async ctx => {
2020-04-08 04:41:57 +12:00
const clientDatabase = couchdb.db.use(ctx.params.clientId);
2020-04-08 07:34:21 +12:00
ctx.body = await clientDatabase.insert(ctx.request.body);
2020-04-08 04:25:09 +12:00
}
}
module.exports = controller;