Which method in Express.js is used to serve static files?

  • app.static()
  • app.useStatic()
  • app.serveStatic()
  • app.use()
In Express.js, the app.use(express.static()) method is used to serve static files. This method allows you to specify a directory from which Express should serve static assets like images, CSS, and JavaScript. The other options are not valid methods for serving static files in Express.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *