diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2024-02-10 18:37:40 -0700 |
---|---|---|
committer | Vijay A <vraravam@users.noreply.github.com> | 2024-02-13 06:59:44 +0530 |
commit | e1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch) | |
tree | 2dccff36a441916d7014037cef3f7ce84a790cad /bin/server.ts | |
parent | refactor: project maintenance (diff) | |
download | ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.gz ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.zst ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.zip |
updates
Diffstat (limited to 'bin/server.ts')
-rw-r--r-- | bin/server.ts | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/bin/server.ts b/bin/server.ts index fe0fefb..40789e3 100644 --- a/bin/server.ts +++ b/bin/server.ts | |||
@@ -9,14 +9,14 @@ | |||
9 | | | 9 | | |
10 | */ | 10 | */ |
11 | 11 | ||
12 | import 'reflect-metadata' | 12 | import 'reflect-metadata'; |
13 | import { Ignitor, prettyPrintError } from '@adonisjs/core' | 13 | import { Ignitor, prettyPrintError } from '@adonisjs/core'; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * URL to the application root. AdonisJS need it to resolve | 16 | * URL to the application root. AdonisJS need it to resolve |
17 | * paths to file and directories for scaffolding commands | 17 | * paths to file and directories for scaffolding commands |
18 | */ | 18 | */ |
19 | const APP_ROOT = new URL('../', import.meta.url) | 19 | const APP_ROOT = new URL('../', import.meta.url); |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * The importer is used to import files in context of the | 22 | * The importer is used to import files in context of the |
@@ -24,22 +24,22 @@ const APP_ROOT = new URL('../', import.meta.url) | |||
24 | */ | 24 | */ |
25 | const IMPORTER = (filePath: string) => { | 25 | const IMPORTER = (filePath: string) => { |
26 | if (filePath.startsWith('./') || filePath.startsWith('../')) { | 26 | if (filePath.startsWith('./') || filePath.startsWith('../')) { |
27 | return import(new URL(filePath, APP_ROOT).href) | 27 | return import(new URL(filePath, APP_ROOT).href); |
28 | } | 28 | } |
29 | return import(filePath) | 29 | return import(filePath); |
30 | } | 30 | }; |
31 | 31 | ||
32 | new Ignitor(APP_ROOT, { importer: IMPORTER }) | 32 | new Ignitor(APP_ROOT, { importer: IMPORTER }) |
33 | .tap((app) => { | 33 | .tap(app => { |
34 | app.booting(async () => { | 34 | app.booting(async () => { |
35 | await import('#start/env') | 35 | await import('#start/env'); |
36 | }) | 36 | }); |
37 | app.listen('SIGTERM', () => app.terminate()) | 37 | app.listen('SIGTERM', () => app.terminate()); |
38 | app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate()) | 38 | app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate()); |
39 | }) | 39 | }) |
40 | .httpServer() | 40 | .httpServer() |
41 | .start() | 41 | .start() |
42 | .catch((error) => { | 42 | .catch(error => { |
43 | process.exitCode = 1 | 43 | process.exitCode = 1; |
44 | prettyPrintError(error) | 44 | prettyPrintError(error); |
45 | }) | 45 | }); |