Skip to content

Commit

Permalink
removed excersie code
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Ruttner committed Sep 25, 2019
1 parent e4ff9f7 commit 41c0d4d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore

*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
.vscode/
npm-debug.log*

.idea/
.ionic/
.sourcemaps/
.sass-cache/
.tmp/
.versions/
coverage/
www/
node_modules/
tmp/
temp/
platforms/
plugins/
plugins/android.json
plugins/ios.json
$RECYCLE.BIN/

.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
node_modules
venv/
.vscode
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ router.get('/', async (req: Request, res: Response) => {
res.send(items);
});

// Get a specific resource
router.get('/:id',
async (req: Request, res: Response) => {
let { id } = req.params;
const item = await FeedItem.findByPk(id);
res.send(item);
});
//@TODO
//Add an endpoint to GET a specific resource by Primary Key

// update a specific resource
router.patch('/:id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ import * as EmailValidator from 'email-validator';
const router: Router = Router();

async function generatePassword(plainTextPassword: string): Promise<string> {
const saltRounds = 10;
let salt = await bcrypt.genSalt(saltRounds);
return await bcrypt.hash(plainTextPassword, salt);
//@TODO Use Bcrypt to Generated Salted Hashed Passwords
}

async function comparePasswords(plainTextPassword: string, hash: string): Promise<boolean> {
return await bcrypt.compare(plainTextPassword, hash);
//@TODO Use Bcrypt to Compare your password to your Salted Hashed Password
}

function generateJWT(user: User): string {
return jwt.sign(user.short(), "hello")
//@TODO Use jwt to create a new JWT Payload containing
}

export function requireAuth(req: Request, res: Response, next: NextFunction) {
Expand Down

0 comments on commit 41c0d4d

Please sign in to comment.