Describe the differences between a SQL and NoSQL DB, and when you might use each.
Your answer...
What's wrong with this mongoose code and how might we fix it? (Hint: Assuming there is a document with a name of "Bob", why is results not an author model on the second line?)
var results = AuthorModel.find({name: "Bob"});
console.log(results);
// Your answer...
Convert the following ActiveRecord sequence to Mongoose:
@andy = Instructor.find_by(name: "Andy")
@andy.wishlist_items.create(description: "Resin Laying Deer Figurine, Gold")
// Your answer...
Convert the following create method in Mongoose to ActiveRecord.
var authors = {
create: function(req, res){
var author = new AuthorModel({name: req.body.name})
author.save(function(err){
if (!err){
res.redirect("authors")
}
})
}
}
How does module.exports help us with separation of concerns?
Write one Express route for each of the four HTTP methods.
Then, make each route respond with a one-word string containing the RESTful action that would most likely be associated with this route.
var express = require("express");
var app = express();
// Your code starts here...
// Your answer...
Describe the differences between Express and Rails as backend frameworks.
What is the importance of using body-parser in our express application for post requests?