tachybase_todo/packages/samples/hello/src/server/index.ts
2023-01-03 15:17:20 +08:00

33 lines
631 B
TypeScript

import { InstallOptions, Plugin } from '@nocobase/server';
export class HelloPlugin extends Plugin {
beforeLoad() {
// TODO
}
async load() {
// TODO
// Visit: http://localhost:13000/api/testHello:getInfo
this.app.resource({
name: 'testHello',
actions: {
async getInfo(ctx, next) {
ctx.body = `Hello hello!`;
next();
},
},
});
this.app.acl.allow('testHello', 'getInfo');
}
async disable() {
// this.app.resourcer.removeResource('testHello');
}
async install(options: InstallOptions) {
// TODO
}
}
export default HelloPlugin;