May 2017
Intermediate to advanced
388 pages
7h 30m
English
On the server, in index.js, assign the schema to our imported CartCollection using SimpleSchema from Meteor, and validate each method call against it:

The package you need is this:
> meteor add aldeed:simple-schema

CartCollection.schema.validate(product);
To test what it actually does, try changing the price in the schema. Consider that you set the price to be an integer, as follows:
price: { type: Number, decimal: false },
You will get an error in the browser's console:
Error invoking Method 'cartInsert': Price must ...
Read now
Unlock full access