vugu / vugu

Vugu: A modern UI library for Go+WebAssembly (experimental)
https://www.vugu.org
MIT License
4.8k stars 175 forks source link

With the devserver where can I place local assets like images? #213

Closed andrewarrow closed 2 years ago

andrewarrow commented 2 years ago

is there a standard directory like assets or something where I can place an image I want my devserver to serve with a path like http://localhost:8844/assets/my-image.png ?

andrewarrow commented 2 years ago

i ended up adding:

        mux.Exact("/assets/b3.png", devutil.StaticFilePath("assets/b3.png"))

but there must be a better way than having to do this Exact match for each image...

sorenisanerd commented 2 years ago

See https://github.com/vugu-examples/simple/blob/master/devserver.go#L23

Adding that line will expose the whole directory. Try e.g. http://localhost:8844/devserver.go and you'll see.

andrewarrow commented 2 years ago

ah thank u!