A folder setup can be almost anything. We show a proven structure.
[George McKnight] Hello and welcome back. In our previous video, we got a better understanding of how Meteor differs from the request response methods of traditional web applications. Meteor is very flexible when it comes to files and folders. However, they do follow several guidelines and rules that you can use to your advantage. The first thing you should do is separate your folders into a client and a server folder. This is going to tell Meteor that anything inside of the client folder does not load on the server.
And anything inside of the server folder does not load on the client. Which means that basically any files that are not in either one of those folders will run on both the client and the server. If you really wanna stay organized, you can create a folder called both. And even though Meteor doesn't recognize that folder name, it does run anything outside of the client and server folder on both the client and the server, which means that your both folder will effectively run on both. Meteor also recognizes a folder named public.
So let's go into a folder that we wanna create our application in and then we're going to type meteor create. And I'm going to call this quietearth. Now that we've created the application, let's open that folder. And we see that there are three files created by Meteor. We're going to begin by creating our client folder, and put all of our client files into that client folder. Now we can create a server folder. Then we'll create our public folder. And last, we'll create our both folder, where we plan to store any of the files which should load on both the client and the server.
That will include our files for the router, it will also include any collections, and then the files for our accounts. Next, we should go into the client folder and inside of the client folder, let's create a folder for our templates, where we'll place all of the file templates, our helpers and our stylesheets. These are all files that are available to the client, organized by functionality. Next we'll go into the public folder and there's really only one folder here, which is our images folder.
And inside of our server folder, we'll put a folder for methods, for publications, and for permissions. That should include most of the files we're going to use on the server. The next thing we wanna do is go into our templates folder and we'll create some of our starting template folders. Layout is most important because it's used by our router. Next, well add the home template folder, the cart template folder, and lastly, the sidebar template folder.
For each one of the folders that we created in our templates folder, we wanna create a file which is an HTML file. Inside of that we'll create template tags, which is basically template with a name, cart in this example. And then for the home template, we'll do the same thing and we'll create a template for home. So we'll basically call this home.html and create the template tags. And we'll put the word home in here so it shows up on the page.
Then we'll do the same thing for our layout. And we'll create a file called layout.html and within that file we'll create our template tags, along with the word layout just so that it shows up. And lastly, we'll do the sidebar. Which we'll create an html file called sidebar.html and then inside of that file, we're going to once again put the template tags along with the text sidebar inside the template.
Great, so in this video, we've created our entire folder structure, along with some placeholders. And in this section, we covered the Meteor philosophy as it pertains to the request response methods. We also covered the Meteor load order for files and folders, and created the folder structure for our sample application. Let's move on to the next section, which is routing and layout.
George Mcknight starts by carefully designing an application structure and building a single-page layout with multipage routing and authentication. Then he reviews the database data, and looks at how to work with subscriptions and queries. George also dives into the options for templating, with a look at dynamic Blaze templates and the Spacebars templating language. Learn about event handling and then find out how to test your application using Cucumber and Jasmine. After that, George deploys the application locally on the Meteor server, and then to Amazon to set it up for frequent updates and hot code deployment. Finally, you'll learn how to work with third-party integrations and set up REST endpoints to interact with other external services such as PayPal.
- Routing URLs
- Using callback methods
- Setting up user authentication
- Defining a collection
- Setting up subscriptions and queries
- Using templates
- Working with data on the server
- Testing a Meteor application
- Deploying a Meteor application