May 2015
Beginner
220 pages
4h 16m
English
Along with the text and files, we now send a list of user IDs—users that should be tagged in the post. As mentioned before, they come to the server in the form of a string. We need to use JSON.parse to convert them into a regular array. The following lines are part of the backend/api/content.js module:
var form = new formidable.IncomingForm();
form.multiples = true;
form.parse(req, function(err, formData, files) {
var data = {
text: formData.text
};
if(formData.pageId) {
data.pageId = formData.pageId;
}
if(formData.eventDate) {
data.eventDate = formData.eventDate;
}
if(formData.taggedFriends) {
data.taggedFriends = JSON.parse(formData.taggedFriends);
}
...The content.js module is the ...
Read now
Unlock full access