Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 1.91 KB

401-class03.md

File metadata and controls

40 lines (25 loc) · 1.91 KB

Class 401.03

Notes

Readings

Review: ES6 Classes

  1. Classes are a template for creating ____.

    Classes are a template for creating objects.

  2. Can a class declaration be hoisted?

    No, class declarations are not hoisted like regular function declarations.

  3. How would you describe a constructor and contextual “this” to a non-technical friend?

    A constructor is like a recipe for making something, and "this" is like a special ingredient that tells the recipe what you're making at the moment.

Using Express Routing

  1. What is the difference between a route path and a route method?

    The route path is like the address of a place, while the route method is like the way you want to get there (e.g., using a car or bicycle).

  2. When is it appropriate to add "next" as a parameter to a route handler, and what must you do if "next" has been passed to your middleware as a parameter?

    You add "next" when you want to pass control to the next function, and if "next" is passed to your middleware, you should call it to allow the request to move to the next middleware or route handler.

Express Routing

  1. What is an Express Router?

    An Express Router is like a mini-express application that you can use to group routes and middleware together.

  2. By what means do we initialize express.Router() in an express server?

    You initialize express.Router() by creating a new instance of it, usually at the beginning of your server code.

  3. What do we use route middleware for?

    We use route middleware to perform actions or checks before reaching the final route handler, such as authentication or data validation.

Things I want to learn more about

References

  • Google Bard and ChatGPT