-
Install/run local swarm node (referenced at localhost:8500)
-
Install/run local Bluzelle swarm (referenced at my IP address on port 51010)
-
Install/run Bluzelle CRUD visualizer tool
//given this schema ... | |
// { | |
// [id] | |
// name: String, | |
// email: String, | |
// bio: String, | |
// createdAt: Date, | |
// age: 11 | |
// } |
What if we were trying to access data from a domain we weren't hosting on? In other words, what if we had a site on http://example.com but we needed to get data from another domain of ours, http://awesome.com? Because of Same-origin policy implemented by browsers, we can't do this. By default, browsers will only allow Javascript to manipulate or access API resources that originate from the same domain. There are times where we do want communication to happen across domains, which is why we can implement special HTTP headers that define a cross-origin policy and thus allow us to access data across separate domains.
In Node, use this header for simple cross site request blocking:
res.setHeader('X-XSS-Protection', '1; mode=block');
If we want to have data accessible from other domains, we'd need to add the appropriate ‘Access-Control-Allow-Origin’ headers to make this possible:
For the next two days, we're "flipping" the classroom. Flipped classrooms are a very recent technique used by educators to maximize the effectiveness of an in-person class experience. If you use the time effectively, you'll get farther in the next two days during the flipped portion than you would have in a normal setting.
The basic philosophy behind the flipped classroom is that you'll take time on your own to review the lecture before class. This will allow us to spend classtime answering questions, resolving confusion, and expanding what was learned during the lecture. Ultimately, you'll be better prepared for your day's projects and further along as a developer.
For the next two days, you'll be watching two lectures by Chris Esplin, a Firebase expert. He's a part of the Google Developer Experts program and a guest instructor at DevMountain.
this.getFilms = function(char) { | |
var deferred = $q.defer(); | |
//this array will hold references to all of the $http calls that need to be made | |
var film_requests = []; | |
for (var i = 0; i < char.films.length; i++) { | |
film_requests.push( | |
$http({ | |
method: 'GET', |
var mongojs = require('mongojs'); | |
var db = mongojs('test'); | |
var users = db.collection('users'); | |
//find all | |
// users.find(function(err, users) { | |
// console.log(err, users); | |
// }); |
//controller.js | |
myService.getStuff().then(function() { | |
//upon deferred.resolve | |
}).catch(function(err) { | |
//upon deferred.reject | |
}).finally(function() { | |
//no matter what |
# install nginx | |
# sudo apt-get install nginx | |
# configure nginx | |
# /etc/nginx/sites-available/[myconfigfile] | |
# create symlink /\ \/ | |
# /etc/nginx/sites-enabled/[myconfigfile] | |
module.exports = { | |
getCustomer: function(req, res) { | |
///api/customers/:id | |
Customer.findOne({_id: req.params.id}).exec().then(function(err, user) { | |
return res.json(user); | |
}); | |
}, | |
getCustomers: function(req, res) { | |
var sort = req.query.sort || '-createdAt'; | |
var skip = req.query.skip || 0; |
//User, pseudo code!!!!! | |
var userSchema = { | |
name: String, | |
email: String, | |
password: String, | |
gender: String, | |
bio: String, | |
createdAt: Date, | |
age: {type: Number, min: 0, max: 99} | |
}; |