initial
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import { Reception } from './classes.reception.js';
|
||||
|
||||
export class ReceptionServer {
|
||||
public receptionRef: Reception;
|
||||
public serviceServer: plugins.loleServiceServer.ServiceServer;
|
||||
public typedsocket: plugins.typedsocket.TypedSocket;
|
||||
|
||||
constructor(receptionRef: Reception) {
|
||||
this.receptionRef = receptionRef;
|
||||
this.serviceServer = new plugins.loleServiceServer.ServiceServer({
|
||||
serviceDomain: 'reception.lossless.one',
|
||||
serviceName: 'reception',
|
||||
serviceVersion: this.receptionRef.projectinfoNpm.version,
|
||||
port: parseInt(this.receptionRef.serviceQenv.getEnvVarOnDemand('TEST_PORT')) || 3000,
|
||||
addCustomRoutes: async (serverArg) => {
|
||||
serverArg.addRoute(
|
||||
'/typedrequest',
|
||||
new plugins.loleServiceServer.HandlerTypedRouter(this.receptionRef.typedrouter)
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async start() {
|
||||
await this.serviceServer.start();
|
||||
this.typedsocket = this.serviceServer.typedServer.typedsocket;
|
||||
this.serviceServer.typedServer.typedrouter.addTypedRouter(this.receptionRef.typedrouter);
|
||||
}
|
||||
|
||||
async stop() {
|
||||
await this.typedsocket.stop();
|
||||
await this.serviceServer.stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user