Newbie Questions


#1

Hi all,

I’m very new to Meteor so please excuse my very newbie type of questions.

  1. It seems I can create js for the Server and Client either in a folder structure (Server/Client) or in one js file using isCLient / isServer, so you have a choice, is that correct?

  2. Can I add any js add-in / script to the code, in particular RouterBoxer, and it should be ok? It doesn’t need a package for it? https://github.com/denissellu/routeboxer

Thanks,
Marcus


#2

Correct, but the former (separate folders) is better, because isClient and isServer code is still sent to both client and server. Using separate folders keeps the code where it belongs. Use isClient and isServer sparingly and only when you can’t avoid it. Don’t put sensitive code in an isServer block thinking it won’t get sent to the client - it will.

It’s also better to split your app into several, related files organized by directory structure - check the Meteor Guide for more information.

You should also look at using ES2015 modules and structuring your codebase according to common patterns - again, check the Meteor Guide and tutorials for more information.

Yes, although if you don’t use npm modules, you may have more difficulty. The package you highlighted would probably be done best with https://www.npmjs.com/package/geojson.lib.routeboxer

meteor npm install geojson.lib.routeboxer --save

and then

import RouteBoxer from 'geojson.lib.routeboxer';

in those files where you need it.


#3

Brilliant answers, thank you very much for your help, they have been very useful!