adjust index file

This commit is contained in:
Sergo 2023-07-30 10:27:00 +03:00 committed by Lauri Võsandi
parent bd7583cc20
commit d09de4be01
2 changed files with 26 additions and 6 deletions

View File

@ -3,11 +3,31 @@ import { logger } from "./logger";
const port = app.get("port"); const port = app.get("port");
const host = app.get("host"); const host = app.get("host");
const server = app.listen(port);
process.on("unhandledRejection", (reason) =>
logger.error("Unhandled Rejection %O", reason),
);
app.listen(port).then(() => { app.listen(port).then(() => {
logger.info(`Feathers app listening on http://${host}:${port}`); logger.info(`Walias app listening on http://${host}:${port}`);
});
process.on("SIGINT", () => {
logger.info("Received SIGINT signal. Shutting down gracefully.");
server.close(() => {
logger.info("HTTP server closed.");
process.exit(0);
});
});
process.on("SIGTERM", () => {
logger.info("Received SIGTERM signal. Shutting down gracefully.");
server.close(() => {
logger.info("HTTP server closed.");
process.exit(0);
});
});
process.on("unhandledRejection", (reason) => {
logger.error("Unhandled rejection", reason);
process.exit(1);
}); });

View File

@ -47,7 +47,7 @@ export interface AliasesParams extends Params<AliasesQuery> {
export class AliasesService<ServiceParams extends AliasesParams = AliasesParams> export class AliasesService<ServiceParams extends AliasesParams = AliasesParams>
implements ServiceInterface<Alias, AliasesData, ServiceParams, AliasesPatch> implements ServiceInterface<Alias, AliasesData, ServiceParams, AliasesPatch>
{ {
constructor(public options: AliasesServiceOptions) { } constructor(public options: AliasesServiceOptions) {}
async find(params: ServiceParams): Promise<Alias[]> { async find(params: ServiceParams): Promise<Alias[]> {
const userId = await this.getUserIdByEmailAddress(params); const userId = await this.getUserIdByEmailAddress(params);