• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"Hot patches" for node.js code

 
author
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! What's the current (better?) way of hot patching some JS code in use at a node.js server? With Apache, I can just change a PHP file, and from then on, it will be used, but with node.js, it doesn't work that way. I've read about several possible methods, but no one seemed to be as simple as Apache's. What would you recommend?
 
Author
Posts: 15
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Federico Kereki wrote:Hi! What's the current (better?) way of hot patching some JS code in use at a node.js server? With Apache, I can just change a PHP file, and from then on, it will be used, but with node.js, it doesn't work that way. I've read about several possible methods, but no one seemed to be as simple as Apache's. What would you recommend?



Hi Federico,

With Node it's a bit tricker than with PHP/Apache. The way it's mostly done is having a file watcher running in the background that checks for flle changes and, when a file has been found to have been changed, restarts the server. There are a number of watcher utilities out there... "forever" (https://www.npmjs.org/package/forever), created by the folks at Nodejitsu, is one that's been around for awhile and will also restart your server if it crashes.

Cheers,
Mike
 
Federico Kereki
author
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the answer! But, what happens to live, running, connections? I mean, if "forever" restarts the server, and some requests were being processed (by the changed JS code, or by other unrelated, unchanged code) at the time, what happens with them when node.js is restarted?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic