0

I am working on a Node.js app, and am currently debugging it, and I was wondering if it is possible to have a repl running that could change variables defined in the node application itself, not in the REPL's context, is this possible?

For example, i could enter var app = express() into the REPL, and it would also set the variable in the server itself.

If so, how would I go about implementing it and making it secure?

1 Answer 1

1

You cannot directly access the run-time of another javascript interpreter, so if you would like to interact with your running application, you have a few options:

Embed REPL into application directly

Look into the REPL module for adding a REPL inside of your application (your app could start, then show a REPL), and then the VM module for specifying the exact context you are operating on inside the REPL.

Securing it is another thing entirely.

Connect to your application via some API inside a REPL

Set up some interaction model with your application, such as a socket and write both client and server independently. forever is an example of how this interaction works, but it would need to be adjusted for remote javascript execution.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.