2

I can't find anywhere an answer for this: do I need to restart the simple http-server if I edit client files like .html, .css or .js (e.g.: index.html) from the directory the server is based on?

I want to use http-server for development phase, when I edit various files multiple times.

Note: this question is not related to How can I edit on my server files without restarting nodejs when i want to see the changes?

Community
  • 1
  • 1
Alexandru Irimiea
  • 2,513
  • 4
  • 26
  • 46
  • 1
    generally static files served does not require a restart of server. however, if you change any backend rendering code, that will require a restart. – Mox Mar 05 '16 at 18:55

2 Answers2

1

No. The simple http-server should recognize any changes you make to static files like html, css, and js. The simplest thing to do is give it a try.

Jeff Kilbride
  • 2,614
  • 1
  • 20
  • 21
0

The http-server uses ecstatic to serve static content. This library returns a Cache-Control header where default timeout is 3600 seconds (1 hour). You can change the timeout by specifying cache (in seconds) in the options you pass to http-server - which in turn will be passed on to ecstatic

zjonsson
  • 2,196
  • 2
  • 12
  • 12
  • Hmm... I just started `http-server` locally, created an index.html file, loaded it in my browser, made an edit, and loaded it again. The edit showed up when I refreshed the page. I don't think the `Cache-Control` you're talking about affects files that have been modified. – Jeff Kilbride Mar 05 '16 at 18:54