Skip to content

Static File Serving

Zuno includes built-in support for serving static files—perfect for delivering frontend assets, documentation, or public resources like images and stylesheets.


To serve a folder (e.g. public/) as static content, use the staticFiles() middleware:

app.use(staticFiles("public"));

This will make all files inside public/ accessible via HTTP:

public/
├── index.html
├── styles.css
└── images/
└── logo.png
  • /index.htmlhttp://localhost:3000/index.html
  • /images/logo.pnghttp://localhost:3000/images/logo.png

#include <zuno/zuno.hpp>
int main() {
zuno::App app;
// Serve static files from the "public" folder
app.use(staticFiles("public"));
app.listen(3000);
}

Future versions of staticFiles() will support:

  • Custom cache headers
  • Directory listing toggle
  • File extension fallbacks (e.g. .html)

  • Place only public assets in the static folder
  • Avoid exposing sensitive files (e.g. .env, .git)
  • Use a CDN for large or high-traffic assets in production

Now that you can serve static content, explore:


Zuno makes it easy to blend backend logic with frontend delivery—all in modern C++.