34 lines
979 B
JavaScript
34 lines
979 B
JavaScript
|
module.exports = {
|
||
|
name: 'api.db',
|
||
|
dependencies: ["query"],
|
||
|
settings: {
|
||
|
rest: "db/"
|
||
|
},
|
||
|
actions: {
|
||
|
getKey: {
|
||
|
rest: "GET /:key",
|
||
|
handler(ctx) {
|
||
|
return this.broker.call("query.exec", {key: ctx.params.key, params: ctx.params});
|
||
|
}
|
||
|
},
|
||
|
getDbSql: {
|
||
|
rest: "GET /:db/:sql",
|
||
|
handler(ctx) {
|
||
|
return this.broker.call("db.exec", {db: ctx.params.db, sql: ctx.params.sql, params: ctx.params});
|
||
|
}
|
||
|
},
|
||
|
postKey: {
|
||
|
rest: "POST /:key",
|
||
|
handler(ctx) {
|
||
|
return this.broker.call("query.exec", {key: ctx.params.key, params: ctx.params});
|
||
|
}
|
||
|
},
|
||
|
postDbSql: {
|
||
|
rest: "POST /:db/:sql",
|
||
|
handler(ctx) {
|
||
|
return this.broker.call("db.exec", {key: ctx.params.db, sql: ctx.params.sql, params: ctx.params});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|