Sometimes I find myself wanting to execute some privileged code on the server while the app is running. For example, I may want to quickly delete a document in a collection (when the client-side is blocked from doing so). Or, I may want to quickly try out server-side functions like Email.send and Accounts.createUser.
So what are some of the ways of achieving this? I’m concerned with both cases of how an meteor app can be run:
- running using the
meteorcommand - running as the bundled node app
Ultimately, I’d also like to setup cron jobs that can execute some code in the Meteor context. Is this directly achievable or doable through workarounds?
Thanks for the help!
Couldn’t you just write server-side methods that only work for your user? Then expose those with
Meteor.methodsand run them in the client console. That’s what I do when I want to test eg.Email.send. You could also go a step further and write a rudimentary admin UI.For instance, on the server:
On the client: