SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member randie's Avatar
    Join Date
    Oct 2008
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    >>> Page 89, Re: middleware

    Hi, Don. On page 89 you say "Express.js provides middleware functionality ..." so you could do this kind of thing:

    app.get("/foobar", middleware, function(res, req) {...});

    I understand the concept, and I see that it does work as you describe. But I couldn't find this optional middleware parameter documented anywhere in Express' (or even Connect's) API reference. I looked here:


    Going by just the API for express().get(), I would not have guessed that you could provide a middleware function as an optional second parameter. How did you figure this out, if there's no mention of it in express().get()'s API? Can you provide more than 1 middleware, like so:

    app.get("/foobar", middleware1, middleware2, ..., function(res, req) {...});

    Please send link to the API that describes this optional middleware parameter for express().get().

    Thanks.

  2. #2
    SitePoint Author
    Join Date
    Nov 2012
    Posts
    48
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •