Raja Muhammad Asher
Raja Muhammad Asher

Raja Muhammad Asher

Write the code to start serving static files in
Express.js.

Photo by Joan Gamell on Unsplash

Write the code to start serving static files in Express.js.

Raja Muhammad Asher's photo
Raja Muhammad Asher
·Jul 12, 2022·

1 min read

To serve static files such as images, CSS files, and JavaScript files, use the express.static built-in middleware function in Express.

app.use(express.static('public'))

Source:

Serving Static Files in Express. expressjs.com/en/starter/static-files.html.

 
Share this