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
-
2node.js does not execute code client-side. It does not pre-process anything. node.js is a server-side platform only.Brandon– Brandon2014年07月31日 17:05:16 +00:00Commented Jul 31, 2014 at 17:05
1 Answer 1
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
-
ok thanks for the help. I couldnt find that anywhere in documentation.8bitedge– 8bitedge2014年07月31日 16:58:15 +00:00Commented Jul 31, 2014 at 16:58
lang-js