Auth & Project Night 2

Leon Noel

#100Devs

"Who is that surrounding me?
Enemy, enemy you crossed the wrong boundary, poof!
Wicked witness wizardry
Disappear from here and end up in a tree
Crossed the wrong boundary"

Agenda

  • Questions? 

  • Let's Talk -  #100Devs

  • Due - Professional Checklist

  • Learn - Local Auth

  • Build - Project Night

  • Homework - Start Interview Prep

Questions

About last class or life

Checking In

Like and Retweet the Tweet

!checkin

Submitting Work

I WANT IT - CHECKLIST

Homework: https://forms.gle/MUdE5XCY7VGKup1y8

Please Triple Check Before You Submit! No incomplete / fake work. It just makes my life more difficult and won't help you...

 

BACKEND REVIEW CLASS

SUNDAY Sept 11th
1:00pm EST

Authentication? Logged In Users? HOW?

MVC

Step 1: Go to File > Preferences > Settings

Step 2: search for "workbench.editor.labelFormat"

Step 3: select medium from a drop-down

Client Makes A Request

Client

Server

someurl.com/todos

Loggining In or Signing Up redirects you to

Server Is Setup To Hear That Request

Server

Running Code

We Wrote

To Handle The Request

Bottom of server.js file

Top of server.js file

routes/todos.js

Router Hears The Request

routes/todos.js

WHAT TYPE OF REQUEST WAS IT?

routes/todos.js

Check If Logged In

routes/todos.js

ARE YOU LOGGED IN?

middleware/auth.js

 

Ok, logged in, but what controller?

routes/todos.js

Controllaaa

Which METHOD tho...

controllers/todos.js

routes/todos.js

Who is logged in?

controllers/todos.js

SHOW ME THAT REQUEST

How do I get the todos?

controllers/todos.js

MONGOOSE

models/todos.js

Mongoose

Collection

document

document

document

document

Mongoose provides a straight-forward, schema-based solution to model your application data.

Mongoose

Collection

document

document

document

document

Each schema maps to a MongoDB collection and defines the shape of the documents within that collection.

const UserSchema = new mongoose.Schema({
  userName: { type: String, unique: true },
  email: { type: String, unique: true },
  password: String
})

Mongoose

Collection

document

document

document

document

Models are fancy constructors compiled from Schema definitions. An instance of a model is called a document.

Models are responsible for creating and reading documents from the underlying MongoDB database.

module.exports = 
  mongoose.model('User', UserSchema)

It Goes Down In The DB

Pass It To The Views

controllers/todos.js

I was running through...

views/todos.ejs

Render THAT

controllers/todos.js

HAPPY USER

Team Projects!

Homework

Do: Finish Project

#100Devs - Auth & Project Night Part 02 (cohort 2)

By Leon Noel

#100Devs - Auth & Project Night Part 02 (cohort 2)

Class 51 of our Free Web Dev Bootcamp for folx affected by the pandemic. Join live T/Th 6:30pm ET leonnoel.com/twitch and ask questions here: leonnoel.com/discord

  • 1,828