salvo-static-files

Serve static directories, files, and RustEmbed assets in Salvo apps.

20|5|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/salvo-rs/salvo-skills --skill salvo-static-files
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: salvo-static-files
Source: https://github.com/salvo-rs/salvo-skills/tree/main/skills/salvo-static-files
Command: npx skills add https://github.com/salvo-rs/salvo-skills --skill salvo-static-files

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Serving static files and embedded assets is a common requirement for web apps, but configuring routes, defaults, caching, and SPA fallbacks can be error-prone when using a framework like Salvo.

Core Features & Use Cases

  • Serve static directories with optional defaults and directory listings.
  • Serve single files and embedded assets via RustEmbed support.
  • SPA-friendly fallbacks and cache-control options for production deployments.
  • Use cases: serving CSS/JS/images, delivering uploads or public assets, or embedding assets for a single-binary deployment.

Quick Start

Set up a Salvo app to serve static files from a directory with a default file and optional directory listing.

Frequently Asked Questions about salvo-static-files

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I serve static files in a Salvo web application?

To serve static files in a Salvo web application, you route requests using StaticDir or StaticFile components. This allows you to map directories, single files, and assets directly to HTTP endpoints with configurable defaults and directory listings.

Can I embed static assets into a single binary for production with Salvo?

Yes, you can embed static assets for a single-binary deployment in Salvo using RustEmbed support. This bundles your CSS, JS, and images directly into the compiled executable, eliminating external file dependencies at runtime.

What is the best way to configure SPA fallbacks when serving static assets?

Configuring SPA fallbacks for static assets involves routing unknown paths to a default index file. Salvo supports SPA-friendly fallbacks, ensuring client-side routing works correctly by serving the entry point for unmatched routes.

Does Salvo support directory listing and default files for static directories?

Yes, Salvo supports optional directory listing and default files when serving static directories. You can configure these options to automatically display folder contents or serve a specified default file for directory requests.

How do I set cache-control headers for static files in Salvo?

You set cache-control headers for static files in Salvo using configurable cache options. This enables production-ready HTTP caching, reducing bandwidth and improving load times for static assets like CSS and JavaScript.

Why use embedded assets instead of serving files directly from a directory?

Embedded assets bundle files into the binary via RustEmbed, providing a self-contained executable for deployment without external file dependencies. Serving from a directory reads files at runtime, which is easier for development but requires managing file paths in production.