-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
34 changed files
with
3,217 additions
and
101 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/bif-cmd-api-server/src/main/typescript/common/servers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Server } from 'http'; | ||
import { Server as SecureServer } from 'https'; | ||
|
||
/** | ||
* Utility class for handling common tasks for NodeJS HTTP/S server objects. | ||
*/ | ||
export class Servers { | ||
|
||
/** | ||
* Returns with a promise that resolves when the server has been shut down. Rejects if anything goes wrong of if the | ||
* parameters are invalid. | ||
* | ||
* @param server The server object that will be shut down. | ||
*/ | ||
public static async shutdown(server: Server | SecureServer): Promise<void> { | ||
if (!server) { | ||
throw new TypeError(`Servers#shutdown() server was falsy. Need object.`); | ||
} | ||
return new Promise<void>((resolve, reject) => { | ||
server.close((err: any) => { | ||
if (err) { | ||
reject(new Error(`Servers#shutdown() Failed to shut down server: ${err.stack}`)); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/bif-cmd-api-server/src/main/typescript/public-api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { ApiServer } from './api-server'; | ||
export { ConfigService } from './config/config-service'; | ||
export { ApiServer, IApiServerConstructorOptions } from './api-server'; | ||
export { ConfigService, IBifApiServerOptions } from './config/config-service'; | ||
export { CreateConsortiumEndpointV1, ICreateConsortiumEndpointOptions } from './consortium/routes/create-consortium-endpoint-v1'; |
Oops, something went wrong.