Coding node.js without restarting the "server" - node.js

I've been playing with Meteor (you probably know it's a node.js framework), and really like how you can start it up, and then leave it running while code updates are implemented automatically upon saving.
Is there a way I can do this just running node.js?

Have you tried nodemon? It's almost the same you are looking for.

Related

Is there a way to tell what is keeping a node.js program alive?

I have a node.js program that's hanging after completing everything I want it to do. I'm fairly certain it is an open connection somewhere that is keeping the program from exiting. Is there a way to tell/debug what is keeping the program from exiting?
Unnecessary edit: This question is in no way similar to my question: How do I debug Node.js applications? . Thanks for playing tho..
There is an npm module Why is node running module which helps in "Node is running but you don't know why?"

NodeJS Express App still works despite forgetting app.listen()

I had a strange problem with my routes in my NodeJS project and it turns out that the reason was that I forgot to add app.listen() at the end.
Everything else was written and working normally though. That is to say, my pages were being served and all the code seemed fine.
But I'm puzzled. Why did my code work before I had app.listen() in there?
I don't intend to post the whole project, I'm just looking for helpful suggestions and scenarios people can think of regarding how this can possibly happen.
Really can't give a definitive answer without the code, but it might have to do with your development environment. You might have included app.listen() in a previous iteration and executed the program. In some operating systems, closing out of terminal won't kill the current process, but keep it running. So, your server could have been running the whole time, and you were getting routing problems because whenever you ran your new code, it wasn't listening on the proper port.
Though, this might not apply to your situation.

Is using 'forever' still the suggested approach to run nodejs as a linux/unix service?

In the past couple of years NodeJS became a major player in the server landscape - and I really find it hard to believe that there is no decent way to have nodejs run as a service on a linux box. On Windows we have iisnode - but for non Windows environments the forever package is suggested as the way to go - instead of a real solution.
Is there maybe a servicized version of nodejs out there that I could not locate?
There isn't a "servicized" version of Node.js available in the sense you are thinking. Keeping your Node application running (for example in the event of a fatal error) is up to you entirely.
As suggested in the first comment, this is fairly subjective, but really there are two big packages (and one or two alternative methods) for making a service out of your Node application. As you've mentioned, forever is a popular choice. If you've never taken a look at pm2, I suggest doing so, as it offers some services that forever does not. Alternatively, you could search for information on supervisord, which I've had success with in the past. Finally, daemonizing Node with upstart is something to look at if the others don't fit well for you.

Way to connect Clojurescript Repl to running node process

I was wondering if there is a way to connect a cljs repl to a nodejs process that I already have running, that is say in debug mode and stopped at a breakpoint.
So I know there is https://github.com/bodil/cljs-noderepl, and I have this running fine, but it starts up a 'sandboxed environment' as it says in the documentation. I'd like it to connect to a node process of my choosing (e.g. node debug my_project.js).
I can use the normal node debugger, but that's plain old JS, not CLJS.
I also looked into nRepl, but that doesn't seem to be the solution.
Is what I'm asking for possible at the moment, or can I only do this type of repl in a browser environment?
Thanks
I know it's a bit late, but I don't think node has a way to communicate with a running enviroment. nREPL actually is a step there as it will listen in a nodejs app and let clients send it code, but I haven't seen a nREPL server for node.js clojurescript.
The best I've gotten is https://plus.google.com/112151928607622120183/posts/fNr5h8BgLEp

Starting NodeJS - what code to look for?

We have a whiteboard application powered by NodeJS sitting on a 'cloud' server (rackspace cloud). I recently scaled our server up to accommodate for the anticipated traffic with our launch, and in the process it shut down NodeJS. We are launching our product in a few hours, and our NodeJS developer has gone for the day.
The whiteboard application is supposed to run at http://rayku.com:8001 (the port is opened). However, it's not working because the port isn't listening to anything with NodeJS shut down.
I honestly have no idea which js file to run in order to start NodeJS for the whiteboard. There are many js files in a 'whiteboard' folder. Do you know what type of code I should look for that might suggest it is the right one? Or, do you know what types of logs I can dig up that might point me in the right direction?
Much appreciated
Look for app.js, server.js or something similar. It isn't required but a lot of people use app.js from what I have seen.
node or nodejs is typically the command to start. You may need to set environmental variables or arguments depending on how the developer set things up.
Also make sure to run it with screen or forever so it doesn't quit when you log out.
For common code. createServer is probably what is used to open the server itself. That is consistent between the core libraries and a lot of the frameworks. There might be another file that loads the module prior to executing so running might not work.

Resources