cli/assets/templates/service/ts/some.classes.some.ts
2024-06-21 19:48:43 +02:00

27 lines
1005 B
TypeScript

---
fileName: {{module.name}}.classes.{{module.name}}.ts
---
import * as plugins from './{{module.name}}.plugins.js';
import * as paths from './{{module.name}}.paths.js';
import { {{module.name}}Db } from './{{module.name}}.db.js'
export class {{module.name}} {
public projectinfo: plugins.projectinfo.ProjectInfo;
public serverInstance: plugins.loleServiceserver.ServiceServer;
public serviceQenv = new plugins.qenv.Qenv('./', './.nogit');
public {{module.name}}Db: {{module.name}}Db;
public async start() {
this.{{module.name}}Db = new {{module.name}}Db;
this.projectinfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
this.serverInstance = new plugins.loleServiceserver.ServiceServer({
serviceDomain: '{{module.domain}}',
serviceName: '{{module.name}}',
serviceVersion: this.projectinfo.npm.version,
addCustomRoutes: async (serverArg) => {
// any custom route configs go here
}
});
await this.serverInstance.start();
}
}