LogoRevali

Public Files

Serve static files from the project's public directory

Files in the public/ directory at the project root are served as static files, at the server root, without the app prefix. Use it for favicon.ico, robots.txt, images and other assets that need no endpoint.

Example#

my_app/
├── public/
│   ├── favicon.ico
│   ├── robots.txt
│   └── images/
│       └── logo.png
├── routes/
└── pubspec.yaml
curl http://localhost:8080/favicon.ico
curl http://localhost:8080/images/logo.png

Behavior#

DetailValue
URL /<path inside public/> . The app prefix ( /api ) is not added.
MethodGET (and automatic HEAD/OPTIONS).
CORSAll origins allowed.
Headers Content-Type from the file extension, plus Content-Length , Last-Modified , Accept-Ranges and Content-Disposition .
Discovery Files are listed when the server is generated. After adding or removing a file, regenerate: press r in dart run revali dev , or run dart run revali dev --generate-only .