Could we start Colyseus app with npm package forever?
-
We are facing some issue while using npm package forever Trying to restart the server automatically after crash.
Below is the code.
Before
"start":"nodemon --watch '**/*.ts' --exec ts-node index.ts""
After
"start": "forever start --minUptime 1000 --spinSleepTime 10000 ./index.ts",
"scripts": { "start": "forever start --minUptime 1000 --spinSleepTime 10000 ./index.ts", "bundle-colyseus-client": "browserify ./node_modules/colyseus.js/lib/index.js -s Colyseus -o static/colyseus.js", "build": "npm run bundle-colyseus-client", "heroku-postbuild": "npm run build" }
Server Stop after processing file
-
Aah interesting I'm also wondering about this thing but don't know about forever package. Hope so it will solve my problem too while deploying the game I'm working on multiplayer puzzle game in JS. And noticed that whenever server is crashed need to spin it again.
-
did you resolve this issue?
-
@ahtashamabbasse AFAIK you can't use
forever
with TypeScript files, you need to compile them into JavaScript and run it against the JavaScript output.Compile the project:
tsc -p tsconfig.json
Start
forever
using compiledlib/index.js
forever start --minUptime 1000 --spinSleepTime 10000 ./lib/index.js