Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKelby Nylander
Full Stack JavaScript Techdegree Student 9,455 Pointsconfiguring middleware documentation?
When the instructor talks about the configuring of middleware, there is not much of an indication as to how it works and can be applied to other instances. When looking at the express documentation of app.use() i am not seeing any mention of it. Is "by:" just used as plain text to explain that we are multiplying by 10? Or does it have some significance in the code? Can anyone explain how this works and how to use it?
1 Answer
Jason Larson
8,361 PointsI will start by saying that I'm not actually familiar with Express, but I watched the video and I stayed at a Holiday Inn Express last night, so I think I can explain it.
I believe the by:
is just a property name the instructor decided to use because it makes sense when you're reading it. This is much the same as any time you're writing a function and you are choosing the variable or parameter name to use in the function. In the actual function, he opts to use the name config
for the parameter that is passed in from by
. It looks like any time you want to pass a value like this, you configure your function with an outer function that takes a parameter, and you pass in the value via an object, and use that value in your function.
I am assuming this information is correct. You could test it by putting in a different property name (like 'times') and confirm if you still get the correct results.