Does Meteor have a REPL?
Asked Answered
P

3

16

Does the Meteor framework come with a REPL or console of some kind? If not, any idea how to use the Node.js REPL in a way that bootstraps the Meteor environment?

I'm essentially looking for something like the rails console, or the javascript console in a web browser: a command line interface that makes the application's full context available, so I can arbitrarily inspect objects like Meteor and Template.

Penniepenniless answered 31/12, 2012 at 2:25 Comment(3)
I think a little more information on what you are trying to accomplish and why would help you get answers. On the surface this looks like an odd question, as the meteor command starts the server up and meteor mongo gives you access to meteor's mongo db.Dioscuri
@limelights thanks for the tip. I went back and accepted some answers.Penniepenniless
No worries mate, enjoy! :)Mulatto
P
9

Meteor does not currently have a REPL, but it's on their roadmap. In the interim, you can access the client-facing part of your app in the browser's javascript console.

Penniepenniless answered 4/1, 2013 at 23:25 Comment(1)
This answer is now obsolete. Meteor does have a server-side REPL, see Léo Lam's answer below!Weisbart
H
18

Yes, since version 1.0.2, Meteor has a REPL.

Simply use meteor shell to be dropped to the REPL, which is very similar to Node's.

$ meteor shell

Welcome to the server-side interactive shell!

Tab completion is enabled for global variables.

Type .reload to restart the server and the shell.
Type .exit to disconnect from the server and leave the shell.
Type .help for additional help.

> Meteor.isServer
true
> 

You will have access to the full Meteor environment, and code will be run as if it were server-side code.

Herbivorous answered 16/5, 2015 at 13:50 Comment(1)
Note that a Meteor server needs to be running, it won't pop one.Weisbart
P
9

Meteor does not currently have a REPL, but it's on their roadmap. In the interim, you can access the client-facing part of your app in the browser's javascript console.

Penniepenniless answered 4/1, 2013 at 23:25 Comment(1)
This answer is now obsolete. Meteor does have a server-side REPL, see Léo Lam's answer below!Weisbart
I
1

You can type meteor mongo to open a MongoDB shell on your local development database. See http://docs.meteor.com/#meteormongo

You can also open a console in your browser (in chrome, type alt+command+i), tab console. Here you can type javascript commands as if you were on the client.

To issue commands directly to the server, you can try this project: meteor-server-console:

Connect to a meteor server, evaluate expressions or execute custom helper functions and browse the results/log output.

Invigorate answered 18/4, 2014 at 20:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.