Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.16 KB

File metadata and controls

43 lines (30 loc) · 1.16 KB

Rust fileserver example (standalone)

This is an example of using spin-fileserver as a separate component in a Spin application. In other words, this example demonstrates standalone use of this component as opposed to the composition approaches demonstrated in the rust, javascript and pythong examples.

Prerequisites

Once you have Rust installed, the following should give you everything else:

rustup target add wasm32-wasi

Building and Running

To build and run the example, run:

spin build -u

Then, in another terminal, you can test it using curl:

curl -i http://127.0.0.1:3000/hello

The above should return a response body Hello, world!, served up by the example app itself. All other URIs are handled by spin-fileserver, e.g.:

curl -i http://127.0.0.1:3000/foo.txt
curl -i http://127.0.0.1:3000/nonexistent.txt