0

Doing client-side code is easy because there's the Chrome developer console and I can run meteor commands on it, check objects, check collections, and do practically anything.

I just began doing some Meteor server-side code and I feel like I'm coding in the dark. So far I've just been wrapping everything into a Meteor Method that I can call from the front end, and I watch the meteor command line window to see what console logs.

Are there better ways to do this?

fuzzybabybunny
  • 5,146
  • 6
  • 32
  • 58
  • Do you mean debugging server-side Meteor code? If so, http://stackoverflow.com/questions/11034941/meteor-debug-on-server-side – supertopi Jun 30 '14 at 12:51
  • Have you used this personally? I just tried it and I get `(STDERR) debugger listening on port 5858` and when I go to `http://localhost:8080/` I have a `cannot GET/` – fuzzybabybunny Jun 30 '14 at 13:18
  • If the debugger is listening on port:5858 should you use it instead of port:8080 ? – supertopi Jun 30 '14 at 13:20
  • Sorry, I go to http://localhost:8080/debug?port=5858 and it shows something. Ok, I'm going to have to play around with this - have no idea how to get it working but I guess I need to read some docs. So to be clear, the only way to run server-side console commands is to actually lock down Meteor from running normally? I can't browse to my app or anything anymore. – fuzzybabybunny Jun 30 '14 at 13:23
  • How do I stop debugger? It keeps on starting every time I try to start my meteor app, rendering it inoperable. – fuzzybabybunny Jun 30 '14 at 13:39
  • Do you have an example of what you are trying to debug ? The console works server side, it will output objects in your terminal. But you won't be abel to manipulate them. Usually, it's not a problem since you can access your base from the client. And if you want to see exactly what a server method returns and what is the error, just... return it. You'll be able to get it in your chrome console. – fabien Jun 30 '14 at 13:54
  • You'll need to pause the debugger to examine objects, see http://stackoverflow.com/q/22360652/586086. It's not quite the same as the Chrome Developer tools. – Andrew Mao Jun 30 '14 at 14:58

1 Answers1

0

You can hook up node-inspector to your Meteor server as you would any normal Node app, but you won't be able to inspect objects in the process without pausing it. This is due to a limitation in node-inspector - Chrome injects some custom code into the Javascript engine so that inspections can happen as part of the event loop.

For more information, see the following question. The creator of node-inspector offered to help implement this functionality for anyone who was interested:

Can node-inspector debug an app without pausing it?

Community
  • 1
  • 1
Andrew Mao
  • 35,740
  • 23
  • 143
  • 224