Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Build Applications with Meteor

You're reading from   Build Applications with Meteor Isomorphic JavaScript web development

Arrow left icon
Product type Paperback
Published in May 2017
Publisher Packt
ISBN-13 9781787129887
Length 388 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dobrin Ganev Dobrin Ganev
Author Profile Icon Dobrin Ganev
Dobrin Ganev
Arrow right icon
View More author details
Toc

On the server


On the server-side, we have two files: index.js and insertData.js. There is also a private folder where we can define sample data that we can work with. Meteor will treat the private folder as an assets folder and will not bundle it with the rest of the execution code, which makes it a perfect place to have the test data.

In the private folder in file, products.json will have the following fields:

private/products.json

The fields of the Products collection are as follows:

id: This is the product ID.

title: This refers to a product title.

price: This is the price per unit.

inventory: This is the currently available product inventory in the store.

department: This refers to the department ID the product belongs to.

In the root of the application tree, we also have a shared folder where we can have modules used by both the client and the server.

In there, we define the two Collections that we will be using: Products and Cart:

export const ProductsCollection = new Mongo.Collection('products...
You have been reading a chapter from
Build Applications with Meteor
Published in: May 2017
Publisher: Packt
ISBN-13: 9781787129887
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime