- Instructions for downloading and installing padawan can be found at the bottom of the github page:
- There are files that are used for the client side, the server side, and both.
- The folder
padawan\imports\apicontains code for the server. - The folder
padawan\imports\startupcontains code for the client, server and both. Code for when the server first boots up is also in this folder. - The folder
padawan\imports\uicontains code for the client. This is where the HTML will be, and the CSS will be in a folder called stylesheets. - Meteor uses javascript on both the client side, and the server side. If you have any questions about using meteor, you can search for solutions in the meteor documentation at this website:
- In a
padawan\imports\ui.js file, if you want to call a function on the server, you can use Meteor.call. The variables a, b, and c below describe the parameters for aMeteor.call:
let a = 'server_side_method' This identifies what code will be run on the server;
let b = any arguments you want to pass to the server side method will go here seperated by commas;
let c = a function that will execute once the server method has completed and returned to the client;
Meteor.call(a, b, c);
- For the function c above, the function's first parameter will contain any error messages sent back from the server method, and the second parameter will hold the return value from the server method. These varibales can be called inside the c function.
- Be sure that Meteor is imported at the top of the .js file:
import { Meteor } from 'meteor/meteor';
- On the server if you need to make queries of a MongoDB collection, you can do it using methods like .find() .findOne() .find().count(). The code below will find a user object with the username "admin", and store it in myUser.
myUser = Meteor.users.findOne({username: "admin"});
- In the code below, the find method will find all of the users, and the fetch method will convert all of the users into an array.
let usrList = Meteor.users.find().fetch();
- To create a new LearnShareSession object on the server you can use new and save. here is an example:
let ls = new LearnShareSession({
title: lsTitle,
notes: lsNote
});
ls.save();
- Most objects have an _id attribute that can be used to querry the database. To get the above
lsobject from the databse and store it in the variablefindLsyou can use the following code. notice with _id there is no need to use curly brackets {}.
let findLs = LearnShareSession.findOne(ls._id);
- On the client side, Blaze Spacebars in the HTML are used to call the javascript in the corresponding .js file. You can usually Zecognize spacebars because they have double brackets {{}}. For more information on Blaze Spacebars, go to this website:
- In the Spacebar below, the
totalAnswershelper method is called in the corresponding .js file.question.TimesAnswered.LeftSumandquestion.TimesAnswered.RightSumare parameters that the Spacebar passes to thetotalAnswersmethod.
{{totalAnswers question.TimesAnswered.LeftSum question.TimesAnswered.RightSum}}
- If you are using an IDE like atom or notepad++, you can search for keywords through all the files using the keyboard shortcut
ctrl+shift+f. - If you want to know what file a class is being called from, you can usually find it by searching all the files for
const [class_name]. An example would beconst Question. - The file
padawan\imports\startup\server\fixtures.jscontains sample data. If you want to reset the sample data in your database, do a word search for the lineconst delPrevious = 0;If you find it, you can change the 0 to a 1, save the file, let meteor finish running, then switch the number back to 0 so the sample data doesn't keep resetting. - You can use a program like MongoDB Compass to see what is in the database, set the admin email verification status to true, and manually delete items in the Mongo database.
- Here are steps to change the MongoDB Compass admin verification to true.
- Hostname: localhost
- Port: 3001
- Click
CONNECT - Under
My Clusterchoosemeteor > users > emails > 0: Object - Change
verified: falsetoverified: true
- vimium is a browser add on you can use to navigate web browsers quickly: