Giter Site home page Giter Site logo

practice-for-week-10-predict-order-of-express-middleware's Introduction

Predict the order of Express middleware

In this practice, you will predict the order that Express middleware will be invoked when making a variety of requests.

Background

Take a look at the server/app.js file. This file contains the Express application and the middlewares connected to the application.

Predictions

In each of the following scenarios, predict what will be logged in the server logs when a request is made.

You might find it helpful to grab some paper and sketch out a flow diagram for the middlewares in server/app.js.

Write down your predictions for each of the following scenarios.

Scenario #1 GET /

If a client makes a request to GET /, what will be logged in the server logs and in what order?

Scenario #2 GET /other-resource

If a client makes a request to GET /other-resource, what will be logged in the server logs and in what order?

Scenario #3 GET /not-found

If a client makes a request to GET /not-found, what will be logged in the server logs and in what order?

Verify your predictions

Now, it is time to run the application and use the browser or Postman to verify your predictions.

Set up

cd into the server folder.

npm install the dependencies.

Run npm start to start the server on localhost port 5000.

Testing

Request each of the urls. If your prediction matches, that's great! If not, that's ok. This is a skill that needs practice. Review your diagram and use your debugging skills to discover what happened. As needed, formulate good questions for your instructors.

practice-for-week-10-predict-order-of-express-middleware's People

Contributors

aa-assessment-project-manager[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.