Related links
- http://eatornot.mybalsamiq.com
- https://codementor-classes.slack.com/messages/idea2mvp-nutrition/details/
- here localtunnel/localtunnel#60
- http://www.sitepoint.com/5-free-wireframe-applications/
- http://webdemo.balsamiq.com/
- https://app.pluralsight.com/library/courses/handlebars-javascript-templating/table-of-contents
- http://www.pluralsight.com/courses/handlebars-javascript-templating
- http://www.lynda.com/Backbonejs-tutorials/Up-Running-Backbonejs/163089-2.html
Homework
- Lesson 1 Get to know Public
- Lesson 2 Get to know Backbone and Parse
Margie
- DONE Set up collaboration
- List of foods
Karl
- Familiarize with Backbone and Handlebars
- Handlebars demo - Pluralsight
Features
- Hot or Not layout
- Upload from phone photo album
- Nutrition Facts
- Analytics
0 1
Broccoli ------------------|
Chips |------------------
____________|______
- Run
npm install
to generatepackage.json
- Remove the packages from
package.json
that you won't use. Here is a list of what each does- backbone: Backbone.js
- bluebird: For Promise support in node
- body-parser: For dealing with json body
- bootstrap: styling for Frontend
- css-loader: for including CSS
- expore-loader: for exponsive jQuery to jQuery plugins
- express: server
- file-loader: common dependency
- handlebars: Templates
- jquery: Jquery :P
- json-loader: for loading json files in require
- localtunnel: for generating a local tunnel so that external services can hit your local server
- mailgun: mailing service
- moment: date service
- parse: database as a service
- socket.io: socket server
- socket.io-client: socket client
- styler-loader: dependency of css-loader
- twilio: text message API
- underscore: data manipulation toolkit
- url-loader: common dependency
- webpack: frontend asset compressor
- winston: for logging
- Copy
config.sample.js
toconfig.js
(it's git ignored and should never be in repo, should be manually copied) - Install webpack
sudo npm install -g webpack
- Install nodemon
sudo npm install -g nodemon
- Run webpack watcher in on terminal window
webpack --watch
in project root - Run nodemon watchin in another terminal window
nodemon
in project root - Enabled/disable the modules in init that you'll be using
- All your publically accessible content will stem from
public/app/index.js
USEFUL SNIPPETS
Parse
Get Object By Id
var Person = Parse.Object.extend('Person');
(new Parse.Query(Person))
.get(personId)
.then(_.bind(function(data){
})).catch(_.bind(function (err) {
}, this));
Save To DB
new Person({
name: 'Harry'
}).save().then(function () {
//saved
}).catch(function (err) {
//error
});
Twilio
Make A Call
this.twilioClient.makeCall({
to: '+1' + phoneNumber,
from: this.config.twilio.fromNumber,
url: this.config.rootUrl + '/api/v1/startCall'
});
Make A Simple TwiML Response
var resp = new twilio.TwimlResponse()
.say('Hello');
res.set('Content-Type', 'text/xml');
res.end(resp.toString());
Useful TwiML Responses
resp.hangup(); //Hangs up
Send a Text
var messageTpl = Handlebars.compile(
fs.readFileSync('template.hbs', 'utf8')
);
this.twilioClient.messages.create({
body: messageTpl({
//fill in template details here
}),
to: '+1' + phoneNumber,
from: this.config.twilio.fromPhone
});
Socket
Emit Data on Server
this.socket.emit('data', 'Some Data');
Capture Data On Client
var socket = require('socket.io-client');
this.socket = socket.connect();
this.socket.on('data', function (data) {
//data
});
Mailgun
Send Message
var emailTpl = Handlebars.compile(
fs.readFileSync('template.hbs', 'utf8')
);
this.mailgun.sendText(
config.email.fromEmail,
toEmail,
'Email Subject',
emailTpl({
//Template details here
})
);