Node.js · Middle · Question 36 of 75
How do you serve a folder of static files in Express?
- ✓Correct answer:
app.use(express.static("public")) - 2
express.files("public") - 3
app.get("*", fs.readFile)
Explanation
express.static sets content types and caching headers and handles ranges. In production, static files are often served by a CDN or a reverse proxy instead.