The server-side setup – FoodMenu
Firstly, we will complete server-side development quickly and precisely. Then, we will concentrate on the Angular.js part.
Collection
Inside the lib
directory, add the collections.js
file. Here, we will put our collection that will be shared across the application. It is better to use the Collection2
package to define a schema and validation. However, to demonstrate, we will assume the schema and develop things. Add the following piece of code to collections.js
:
/** name, chef_name, contents, time, image, quantity, prize, is_published, is_deleted, created_at, updated_at */ FoodMenu = new Mongo.Collection("foodMenu");
The fields in the collection are given in the preceding code comment. We have defined the collection and created an instance as well.
Publish
We will publish the collection. However, before publishing, we need to remove the autopublish
and insecure
packages. After removing them, add publish.js
to the server
directory.
Add the following...