# express.static() — Express.js

Source: https://www.geekswithgeeks.com/en/expressjs/ex-static-files

> Hand out images, CSS, and built frontend assets from a folder.

## A built-in file server

`express.static(root)` returns middleware that serves any file under `root` matching the request path — no route needed per file.

## Serving a public folder

A file at `public/logo.png` becomes reachable at `/logo.png`.

```javascript
app.use(express.static('public'));
// public/logo.png -> GET /logo.png
// public/index.html -> GET /
```

## Custom mount path

Add a prefix so files live under `/static/*` instead of root: `app.use('/static', express.static('public'))`.
