Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions twoter/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//You should section and comment this file into packages, middleware, mongo-related stuff, auth stuff, routes stuff, etc.
var express = require("express");
var path = require("path");
var logger = require("morgan");
Expand Down Expand Up @@ -58,6 +59,7 @@ app.get("/",function(req,res){
}
});

//Your local login doesn't work, because you aren't hooking your login form to anything.
app.get("/login", twote.login);
app.get("/twotes", twote.twoteshome);
app.post("/postTwote", twote.addTwote);
Expand Down
1 change: 1 addition & 0 deletions twoter/authentication.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//I like that you kept this all in a different file!
var passport = require('passport');
var FacebookStrategy = require('passport-facebook').Strategy;

Expand Down
13 changes: 13 additions & 0 deletions twoter/feedback.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Homework Feedback:

Functionality:
- Completion: I had to update all of the testing-related packages to make sure they work. Most of the features work, except your local login page. You styled your login page and it looks super nice, and I like that you cleaned up your twotes page to be split up into divs. In terms of tests, they are nicely written, but most of your tests fail for some reason. Check that out when you get the chance (15/20)
- Bug Free: Remove your log statements when you are in production. You didn't have local login working, and when you remove a twote and then hit logout, your app crashes. (8/10)

Quality:
- Good Coding Practices: Nice folder structure. The different functions that you use is good. (10/10)
- Readability: Try to have more detailed comments for your route functions and in your main.js. Your functions and variables are named well. (8/10)

Also, I ended up using my own auth info, but don't forget to add teaching team as collabs to the developer site, so we can access your stuff.

Good work!!!!!!
14 changes: 7 additions & 7 deletions twoter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"body-parser": "^1.10.1",
"chai": "^2.0.0",
"istanbul": "^0.3.5",
"karma": "^0.12.31",
"karma": "^1.6.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.1.7",
"karma-coverage": "^0.2.7",
"karma-mocha": "^0.1.10",
"karma-phantomjs-launcher": "^0.1.4",
"karma-sinon": "^1.0.4",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"mocha": "^2.1.0",
"sinon": "^1.12.2",
"sinon": "^2.1.0",
"cookie-parser": "^1.3.3",
"express": "^4.10.6",
"express-handlebars": "^1.1.0",
Expand Down
3 changes: 2 additions & 1 deletion twoter/public/javascripts/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//Comment the different components of this file, and remove unnecessary console log statements
var onError = function(err,status){
console.log("status",status);
console.log("error",err);
Expand All @@ -14,7 +15,7 @@ $("#twote-out").submit(function(event){
user_id: user_id,
}).done(function(data){
var div = "<div id='"+data._id+"'div><div class='"+data.user_id+"'><p>"+data.text+"--"+data.user+"</p></div><input class='delete-button' id='"+data._id+"' type='button' value='Delete'></div>";
$('#allTwotes').prepend(div);
$('#allTwotes').prepend(div); //nice use of prepend
}).error(onError)
});

Expand Down
6 changes: 4 additions & 2 deletions twoter/routes/twote.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//Be sure to comment what each route does. Good simple routes though!
var Twotes = require('../models/twoteModel.js');
var Users = require('../models/userModel.js');
var routes = {};
Expand All @@ -10,11 +11,11 @@ routes.twoteshome = function(req, res){
var username = (req.session.passport.user.displayName);

Users.count({username: username}, function(err, i){
if (i==0){
if (i==0){ //good use of checking if username exists
var newUser = new Users({username:username});
newUser.save(function(err){
if (err){
res.sendStatus(500);
res.sendStatus(500); //nice!
return;
}
Twotes.find(function(err,twotes){
Expand All @@ -35,6 +36,7 @@ routes.twoteshome = function(req, res){
})
}
})
//Remove this if not using:
//res.send(newUser);
})
} else {
Expand Down