0

I have just started using keystoneJS and am trying to start my server with grunt. The problem is that the server starts normally and immediately terminates.

Why is that?

here is console log:

C:\Users\xxx\Desktop\xx>grunt express
Running "express:dev" (express) task
Starting background Express server
debugger listening on port 5858

------------------------------------------------
KeystoneJS Started:
xxx is ready on port 3000
------------------------------------------------


Done, without errors.


Execution Time (2014-10-25 21:13:11 UTC)
loading tasks  64ms  ■■ 2%
express:dev      4s  ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 98%
Total 4.1s
ditoslav
  • 4,563
  • 10
  • 47
  • 79
  • If it's starting a background server, it starts the background task, then exits the script that starts the background task, but the background task is still running... – markasoftware Oct 25 '14 at 21:24
  • @torazaburo I'm trying to do this as fast as possible so I just need grunt to do as he's told, I do not wan't to rewrite everything by myself. – ditoslav Oct 25 '14 at 21:27
  • @Markasoftware That doesn't sound like something one might wan't to happen. How sure are you of this? My website isn't being run in the background once this is terminated. – ditoslav Oct 25 '14 at 21:27
  • Well, it says `Starting background Express server` in the output, so I'm just taking a guess at how it's working. And thats how forever works as well – markasoftware Oct 25 '14 at 21:28

1 Answers1

1

Use the following process:

  • Use another port rather than 5858 as the debugger port

    var express = require('express');
    var app = express();
    app.listen(9998);
    
  • Use another port rather than 3000 as the KeystoneJS port

    keystone.set('port', 9999)
    
  • Use keepalive:

    nohup grunt connect::keepalive & #Linux
    
    Start-Process grunt connect::keepalive #Windows
    

References

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265