Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8620119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:30:28+00:00 2026-06-12T06:30:28+00:00

I am looking for some documentation on the app.get function of express.js. app.get( ‘/path’,

  • 0

I am looking for some documentation on the app.get function of express.js.

app.get(
    '/path', 
    middleware(),
    function(req, res) {
        res.redirect('/');
    }
);

The example above takes three parameters. The normal docs only show two. I’m interested in what this middle param does and how to use it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:30:29+00:00Added an answer on June 12, 2026 at 6:30 am

    The docs for that are part of the app.METHOD documentation, where get is one of the supported HTTP methods.

    The second, optional parameter, is called middleware (and you can pass an array of middleware functions). This is a function that’s called before the third parameter callback (the actual route handler) and the responsibility of a middleware function is to allow your code to follow the DRY (don’t repeat yourself) principle.

    Example of middleware functions are permissions checks, access validations, validation of sessions (if user is not in logged in, take him to a log in page), and such.

    Since several routes might desire the same behavior, you use a middleware so that you don’t have to write the same code several times.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to get some additional performance (FPS) increases on my iPhone App. I'm
I'm looking for some documentation on how Information Retrieval systems (e.g., Lucene) store their
I'm looking for an introduction/ some documentation of System.Reactive.Joins, which includes the Pattern, Plan,
I'm looking for some advice on how to go about reading the online documentation
I'm looking for some good documentation/examples on how to temporarily pass control to an
I was trying to get some info from documentation, but it seems that it
Im looking for an example or a guide to how create an app like
I've been looking at the astroboy example code and documentation for RoboGuice 2, and
I'm fiddling with a bit of c++/opencv. I was looking some of the samples
Looking at some assembly code for x86_64 on my Mac, I see the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.