This example shows how you can make a custom resource.

The example resource we’ll be making will be a Plain Data Object (which we will refer to as pdo), and outputs the value that you pass into the “name” attribute for the resource.

We are using the Axum framework in main.rs so we can showcase the resource in action, but the implementation is entirely separate from what web framework you use so you can add your custom resource to any Shuttle-hosted resource.

You can clone the example below by running the following (you’ll need cargo-shuttle installed):

cargo shuttle init --from https://github.com/shuttle-hq/shuttle-examples \
  --subfolder custom-resource/pdo