Autostrada
Autostrada
Create a new codebase Get Autostrada Plus
Documentation Changelog Roadmap Give feedback
Login

DocumentationTraditional web application › Serving static files

Serving static files

Static files for your web application should be stored inside the assets/static directory. By default, this directory contains the sub-directories css, img and js, which are intended to store CSS files, images and JavaScript files respectively.

You'll see that there is an assets/static/css/main.css file already present, which contains some basic CSS styles for the application. Feel free to edit this as you wish.

When you build or run the application, the files in assets/static directory will be embedded into the application binary. Specifically, they will be available via the EmbeddedFiles variable in the assets/efs.go file.

By default, these embedded files are served using Go's http.Fileserver whenever the application receives a GET request with a path beginning /static/.

So – for example – if your application is running on localhost:6633:

Feel free to rename, remove or add new folders within assets/static as necessary to organize your files in whatever way you want.

Because static files are served using the Go http.FileServer it's worth mentioning that we get some nice features for free, including: