I am not sure what the method .use() does, the course says that it’s used to mount middleware (which then states that it will explain later what middleware is, so that isn’t much help). What does ‘mounting middleware mean’?
in “computer speak” the word mounted usually means ‘to make accessible’ in some way. For eg. you can mount a drive. Meaning that before it was mounted, you couldn’t access it, and after you mounted it, it became available for you to use.
So imagine that ‘middleware’ is some kind of program or programs and when you call use you are telling the server to make that software available (where it was not before).
Thank you for your patience and responses, but I am still lost. What do you mean the first exposes the /public files? I tried to access https://boilerplate-express-4.ericdominguez.repl.co/public and nothing came up.
It depends on the app and how you want to structure the files for it. If you have a simple site that will not have different routes, then you could go with option 2. This will allow visitors to access files (i.e. index.html, someother.html, etc.) from the root of the site while have the actual files in a different folder than the root folder on the server.
Just keep going in the challenges for this curriculum section and you will see what is typically done.
Most of the time, you will probably go with the first option to keep static files (more like css or js files) accessible in a different public folder. Everyone has different approaches to this though. There is no right or wrong way and really just depends on the app being built.