Serving static files in Express.js

Yatin B.Yatin B.
1 min read

Date: 2021-05-24

This tutorial demonstrates how to serve static files in Express.js using the recommended approach: serving multiple files from a designated directory (e.g., "assets"). It guides you through setting up Node.js and Express.js, creating a package.json file, installing dependencies, and configuring Express.js to serve files from the specified directory using app.use() and express.static(). Finally, it shows how to create an HTML file and access it through the server.

Read more: https://www.javacodegeeks.com/serving-static-files-in-express-js.html

0
Subscribe to my newsletter

Read articles from Yatin B. directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Yatin B.
Yatin B.