Skip to the content.

Express, NPM, TDD, CI/CD

Return to Home

Questions

Review: ES6 Classes

Classes are a template for creating __.

Classes are a template for creating objects

Can a class declaration be hoisted?

No

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

A constructor is a special method that is used to create an object created from a class, and “this” refers to the object that the constructor is creating.

Using Express Routing

Within Express, what does routing refer to?

Routing refers to determining how an application should respond to a client request to a particular endpoint, based on the HTTP method and the requested URI.

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

A route path is the part of the URI that determines which route will be invoked, while a route method is the HTTP method associated with the route, like CRUD functions

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?

It is appropriate to add next as a parameter to a route handler when you want to pass control to the next middleware function in the stack. If next has been passed as a parameter, you must call it at some point in your middleware function to pass control to the next middleware.

Express Routing

What is an Express Router?

Middleware used to control routes in express

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

It creates a new route within the server.

What do we use route middleware for?

Route middleware is used to perform tasks on a route, such as validation, authentication, or logging.