mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-10-14 05:19:19 +00:00
27 lines
552 B
TypeScript
27 lines
552 B
TypeScript
import Plugin from '../../core/types/plugin';
|
|
import MainService from './main.service';
|
|
import Core from './../../core/app/core';
|
|
|
|
const plugin: Plugin = {
|
|
name: 'example',
|
|
version: '1.0.0',
|
|
dependencies: ['logger'],
|
|
|
|
initialize() {
|
|
this.service = new MainService();
|
|
Core.registerService('example', this.service);
|
|
},
|
|
|
|
routes(app) {
|
|
app.get('/api/example', (req, res) => {
|
|
Core.response.success(res, { message: 'Hello from plugin' });
|
|
});
|
|
},
|
|
|
|
onClose() {
|
|
this.service.cleanup();
|
|
},
|
|
};
|
|
|
|
export default plugin;
|