handle stop signal
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/app.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/app.js
									
									
									
									
									
								
							| @@ -70,3 +70,15 @@ io.on('connection', async (socket) => { | ||||
| const server = http.listen(port, () => { | ||||
|     console.log(`server is running on port ${server.address().port}`); | ||||
| }); | ||||
|  | ||||
|  | ||||
| // handle stop signal | ||||
| const shutdown = () => { | ||||
|   console.log('Stopping server.'); | ||||
|   process.exit(); | ||||
|   // server.close(() => { | ||||
|   //   console.log('Stopped server.'); | ||||
|   // }); | ||||
| }; | ||||
| process.on('SIGINT', shutdown); | ||||
| process.on('SIGTERM', shutdown); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user