2

I am trying to learn the theory of node.js but can't seem to figure out how node.js knows whether to pre process it on the server or send it to browser for execution.

asked Jul 31, 2014 at 16:42
1
  • 2
    node.js does not execute code client-side. It does not pre-process anything. node.js is a server-side platform only. Commented Jul 31, 2014 at 17:05

1 Answer 1

4
  • node example.js runs the code server side.

  • require('./example.js') within the server-side JavaScript file also runs the code server side.

  • Serving a static file ending with ".js" to a client will make it a client-side JavaScript.

answered Jul 31, 2014 at 16:48
1
  • ok thanks for the help. I couldnt find that anywhere in documentation. Commented Jul 31, 2014 at 16:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.