- Run
npm installto generatepackage.json - Remove the packages from
package.jsonthat 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.jstoconfig.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 --watchin project root - Run nodemon watchin in another terminal window
nodemonin 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
var Person = Parse.Object.extend('Person');
(new Parse.Query(Person))
.get(personId)
.then(_.bind(function(data){
})).catch(_.bind(function (err) {
}, this));new Person({
name: 'Harry'
}).save().then(function () {
//saved
}).catch(function (err) {
//error
});this.twilioClient.makeCall({
to: '+1' + phoneNumber,
from: this.config.twilio.fromNumber,
url: this.config.rootUrl + '/api/v1/startCall'
});var resp = new twilio.TwimlResponse()
.say('Hello');
res.set('Content-Type', 'text/xml');
res.end(resp.toString());resp.hangup(); //Hangs upvar 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
});this.socket.emit('data', 'Some Data');var socket = require('socket.io-client');
this.socket = socket.connect();
this.socket.on('data', function (data) {
//data
});var emailTpl = Handlebars.compile(
fs.readFileSync('template.hbs', 'utf8')
);
this.mailgun.sendText(
config.email.fromEmail,
toEmail,
'Email Subject',
emailTpl({
//Template details here
})
);