Skip to content

Commit

Permalink
add dependency-free node restart function as suggested by @KaKi87 Sna…
Browse files Browse the repository at this point in the history
  • Loading branch information
schlagmichdoch committed Dec 30, 2022
1 parent 009fcd7 commit b691af7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,25 @@ process.on('unhandledRejection', (reason, promise) => {
console.log(reason)
})

process.on(
'uncaughtException',
() => {
process.once(
'exit',
() => spawn(
process.argv.shift(),
process.argv,
{
cwd: process.cwd(),
detached: true,
stdio: 'inherit'
}
)
);
process.exit();
}
);

const express = require('express');
const RateLimit = require('express-rate-limit');
const http = require('http');
Expand Down

0 comments on commit b691af7

Please sign in to comment.