This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const m3 = { | |
projection: function(width, height) { | |
// Note: This matrix flips the Y axis so that 0 is at the top. | |
return [ | |
2 / width, 0, 0, | |
0, -2 / height, 0, | |
-1, 1, 1 | |
]; | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "123", | |
"title": "Course 1", | |
"modules": [ | |
{ | |
"id": "123", | |
"title": "Module 1 1", | |
"lessons": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "123", | |
"username": "alice", | |
"password": "alice", | |
"email": "alice@wonderland.com", | |
"firstName": "Alice", | |
"lastName": "Wonderland", | |
"role": "FACULTY" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "123", | |
"title": "CS5610", | |
"modules": [ | |
{ | |
"title": "Week 1", | |
"lessons": [ | |
{ | |
"title": "HTML", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"meta": { | |
"grade": { | |
"list": [ | |
"9", | |
"10", | |
"11", | |
"12" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.js | |
(function() { | |
angular | |
.module("EmployeeApp") | |
.config(Config); | |
function Config(<--1--> ) { | |
$routeProvider | |
.when("/user/:uid", { | |
template: "user.view.html", | |
controller: "UserController" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function login(req, res) { | |
var user = req.user; | |
res.json(user); | |
} | |
function logout(req, res) { | |
req.logOut(); | |
res.send(200); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
passport.serializeUser(serializeUser); | |
passport.deserializeUser(deserializeUser); | |
function serializeUser(user, done) { | |
done(null, user); | |
} | |
function deserializeUser(user, done) { | |
userModel | |
.findUserById(user._id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var userModel = require("../../models/user/user.model.server.js")(); | |
var LocalStrategy = require('passport-local').Strategy; | |
passport.use(new LocalStrategy(localStrategy)); | |
function localStrategy(username, password, done) { | |
userModel | |
.findUserByCredentials({username: username, password: password}) | |
.then( | |
function(user) { | |
if (!user) { return done(null, false); } | |
return done(null, user); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var passport = require('passport'); | |
var auth = authorized; | |
app.post ('/api/login', passport.authenticate('local'), login); | |
app.post ('/api/logout', logout); | |
app.post ('/api/register', register); | |
app.post ('/api/user', auth, createUser); | |
app.get ('/api/loggedin', loggedin); | |
app.get ('/api/user', auth, findAllUsers); | |
app.put ('/api/user/:id', auth, updateUser); | |
app.delete('/api/user/:id', auth, deleteUser); |