Why there are multiple serving app notifications on console


#1

The server is executed 4 times

Watching files for changes...

2018-09-12T16:00:20.006Z - info: serving app on http://0.0.0.0:3333
2018-09-12T16:00:20.025Z - info: serving app on http://0.0.0.0:3333
2018-09-12T16:00:20.028Z - info: serving app on http://0.0.0.0:3333
2018-09-12T16:00:20.127Z - info: serving app on http://0.0.0.0:3333
node -v
v8.11.1

npm -v 
5.6.0

I appreciate your collaboration


#2

I found the error, I had this block of code in the file server.js

const cluster = require('cluster')

if (cluster.isMaster) {
  for (let i=0; i < 4; i ++) {
    cluster.fork()
  }
  require('@adonisjs/websocket/clusterPubSub')()
  return
}

You just have to remove it.


#3

Hey @antojsh! :wave:

If you run the server with adonis serve --dev it will automatically restart the server for every file change.