-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (22 loc) · 843 Bytes
/
index.js
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
import app from './app.js'
import http from 'http'
import EventEmitter from 'events'
import process from 'node:process';
const server = http.createServer(app)
import dotenv from 'dotenv'
dotenv.config()
const { PORT, FILENAME } = process.env;
process.on('warning', (warning) => {
const myEmitter = new EventEmitter();
console.log(myEmitter.listeners('close'));
console.warn(warning.name); // Print the warning name
console.warn(warning.message); // Print the warning message
console.warn(warning.stack); // Print the stack trace
});
// ################################################ //
// Server Initialization //
// ################################################ //
const port = process.env.PORT || 3333;
server.listen(port, () => {
console.log(`Server running on port ${port}`)
})