dylanjha
dylanjha

Reputation: 2523

grunt-contrib-connect server can't connect t localhost

My Gruntfile:

...
connect: {
  server: {
    options: {
      port: 8000,
      hostname: 'localhost',
      base: '.'
    }
  }
}
...

Then, when I run grunt connect, I see this:

❯ grunt connect
  Running "connect:server" (connect) task
  Started connect web server on http://localhost:8000

  Done, without errors.
❯

Then that's it. If I got to my localhost:8000. I see chrome can't connect.

Upvotes: 2

Views: 2968

Answers (1)

raidendev
raidendev

Reputation: 2799

If you want to use grunt-contrib-connect as a dev server, please look at keepalive option.

According to the documentation:

Note that this server only runs as long as grunt is running. Once grunt's tasks have completed, the web server stops. This behavior can be changed with the keepalive option, and can be enabled ad-hoc by running the task like grunt connect:keepalive.

Upvotes: 3

Related Questions