It depends on what libraries you use, but in general files aren't loaded
automatically for server-side use, they must be require()'d. You can have
more complicated startup scripts, but it's common to run node app.js or node
server.js (the name doesn't matter) and that's file is your app's entry
point. It can have code and logic and depend on other files, or just depend
on other files. Those are loaded via require() calls, and they in turn
require() other files. This module graph can get large especially with NPM
addon modules, but there's not much ambiguity about what gets loaded.

So as long as you keep your server-side code in one area (and in folders
that aren't automatically viewable in a browser) and public code in another
are and you keep them separate, you're all set. If you want to use a
library in both areas (e.g. underscore.js), you'll typically have a build
step that configures that for you. Whatever app framework you chose will
likely address some of these issues also.

Burt

On Thu, Sep 18, 2014 at 1:39 PM, Aleksandra Czajka <[email protected]>
wrote:

> you have client-side and server-side js files. how does node.js specify
> which .js file runs on server and which runs on browser.
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/c2709c40-cef8-4ce3-b468-c8193a5eb47c%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/c2709c40-cef8-4ce3-b468-c8193a5eb47c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAF1kzTG%2B_EtX9G-%3D9bza0v3nRRmeeHA35gVZuVPPHXK1L%3DorvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to