Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active September 22, 2022 11:52
Show Gist options
  • Save rogerwschmidt/3b493f07b37bc57223a011924c85dcc2 to your computer and use it in GitHub Desktop.
Save rogerwschmidt/3b493f07b37bc57223a011924c85dcc2 to your computer and use it in GitHub Desktop.

Query Builder Instructor Notes

Objectives

  • List the 5 crud operations, what information the request has, and what information is in the respose
  • Define what Knex.js is
  • Follow the request response cycle for an API that uses databases
  • Explain what how the model and the controller are working together to compose a response
  • Describe what happens when you throw inside a promise callback.
  • Describe how a database is set up.
  • Create a select all controller and model
  • Create a select one controller and model
  • Create a create controller and model
  • Create an update controller and model
  • Create a delete controller and model
  • Use SQL joins to create create a nested resource

List the 5 crud operations, what information the request has, and what information is in the respose

  • With you tables, create a table of request and responses information for each HTTP method

Define what Knex.js is

  • With your table, create a description of what Knexjs is and why it is useful

Follow the request response cycle for an API that uses databases

Explain what how the model and the controller are working together to compose a response

  • With your table, explain why promises are being used to commicate between the controller and the model for the route /instructors

Describe what happens when you throw inside a promise callback.

  • With your table, explain what is happening when you throw inside a callback

Describe how a database is set up.

  • With your table, investigate the ./db/index.js and ./knexfile.js
  • In the ./src/models/instructors file, what is being required to use the db

Create a getAll controller and model

  • In groups of 2/3 create a getAll controller and model for /students

Create a getOne controller and model

  • In groups of 2/3 create a getOne controller and model for /students/:id

Create a create controller and model

  • In groups of 2/3 create a create controller and model for `/students

Create an update controller and model

  • In groups of 2/3 create a update controller and model for /students/:id

Create a remove controller and model

  • In groups of 2/3 create a remove controller and model for /students/:id

Use SQL joins to create create a nested resource

  • In groups of 2/3 create a getAll students for the cohorts resource. /cohorts/:cohortId/students
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment