-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.ts
39 lines (32 loc) · 1.26 KB
/
server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
|--------------------------------------------------------------------------
| AdonisJs Server
|--------------------------------------------------------------------------
|
| The contents in this file is meant to bootstrap the AdonisJs application
| and start the HTTP server to accept incoming connections. You must avoid
| making this file dirty and instead make use of `lifecycle hooks` provided
| by AdonisJs service providers for custom code.
|
*/
import 'reflect-metadata'
import sourceMapSupport from 'source-map-support'
import { Ignitor } from '@adonisjs/core/build/standalone'
// TODO: safety net for uncaught exceptions and unhandled promise rejections
// Must look into underlying issues and handle them properly
// Catch uncaught exceptions
process.on('uncaughtException', (error) => {
console.error('Uncaught Exception:', error);
// Optionally, you can exit the process if needed
// process.exit(1);
});
// Catch unhandled promise rejections
process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
// Optionally, you can exit the process if needed
// process.exit(1);
});
sourceMapSupport.install({ handleUncaughtExceptions: false })
new Ignitor(__dirname)
.httpServer()
.start()