mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Split off ServerInitializer.
This commit is contained in:
committed by
Joachim Van Herwegen
parent
b0ecf1c1d8
commit
04a91858c2
20
src/init/ServerInitializer.ts
Normal file
20
src/init/ServerInitializer.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { HttpServerFactory } from '../server/HttpServerFactory';
|
||||
import { Initializer } from './Initializer';
|
||||
|
||||
/**
|
||||
* Creates and starts an HTTP server.
|
||||
*/
|
||||
export class ServerInitializer extends Initializer {
|
||||
private readonly serverFactory: HttpServerFactory;
|
||||
private readonly port: number;
|
||||
|
||||
public constructor(serverFactory: HttpServerFactory, port: number) {
|
||||
super();
|
||||
this.serverFactory = serverFactory;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public async handle(): Promise<void> {
|
||||
this.serverFactory.startServer(this.port);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user