Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a complete list of meteor special directory names and what they do?

Meteor checks directory names and treats javascript inside directories with special names differently. Some of the "magical" directory names that I know of are:

server
client
public
lib
startup
import
node_modules (I think, but I'm not sure)

This list keeps growing and it's getting confusing. Is there a consolidated list of this somewhere? If not, I guess I'll dig through the source and make one.

Edit: I guess I really want to know what filenames are special as well (server.js, client.js, startup.js). I hate the idea that I might name a file or directory something and it will affect the app behavior in unexpected ways.

like image 777
foobarbecue Avatar asked Mar 31 '16 01:03

foobarbecue


People also ask

Where should I put my code in Meteor?

Any sensitive code that you don’t want served to the client, such as code containing passwords or authentication mechanisms, should be kept in the server/ directory. Meteor gathers all your JavaScript files, excluding anything under the client, public, and private subdirectories, and loads them into a Node.js server instance.

How many meteor showers are there in the world?

As of November 2019, there are 112 established meteor showers. Dates are given for 2021. The dates will vary from year to year due to the leap year cycle. This list includes showers with radiants in both the northern and southern hemispheres.

How are JavaScript files loaded in a Meteor project?

By default, any JavaScript files in your Meteor application folder are bundled and loaded on both the client and the server. However, the names of the files and directories inside your project can affect their load order, where they are loaded, and some other characteristics.

How do you name a meteor?

One of the good ways to name something is to simply change one or two letters of a real or known meteor name to create something new which is still recognizable, simple, and memorable. For example, Sarah could become Saral and so forth; the name Jonathan could be Jolothan. Here are some meteor names examples you can try to change on your own: 2.


2 Answers

Update: The Meteor Guide has been updated and now contains 1.2 and 1.3 style load order and special directory information Here

server - Only ran on the server
client - Only sent to the client
client/compatibility - Loaded first before other normal javascript files, put jquery, bootstrap etc here if you're having issues with them elsewhere
public - Static files/assets such as images,music etc available to user
public/online - a folder that won't be cached if configed to
private - Static files/assets only available to the server
imports - Files only loaded when using an import command.
node_modules - used by NPM for node modules, is separate from meteor.
tests - Files for tests - not loaded anywhere else.
lib - loaded on both clients, loaded prior to other code

Any other folder (that I am aware of) is not a special folder but is loaded by both server and client. Startup is not special but is a convention used by developers to state that the files within pertain to the startup of the app, such as config files or fixtures data.

You could use any folder name you wanted that isn't treated specially and it will be loaded on both server and client.

The recommended way to use Meteor now is to use the imports directory and only import code when and where you need it to control the flow and load order.

It is annoying that they removed this list from the Meteor Docs. One of the commenters found a link to the old docs: http://devdocs.io/meteor/index#structuringyourapp Update: Link now points to new meteor guide.

like image 152
Stan Lindsey Avatar answered Sep 22 '22 12:09

Stan Lindsey


The new directory structure for Meteor 1.3 is documented at http://guide.meteor.com/structure.html

like image 40
Michel Floyd Avatar answered Sep 18 '22 12:09

Michel Floyd