Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thorstenhans/spin_book_api
https://github.com/thorstenhans/spin_book_api
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/thorstenhans/spin_book_api
- Owner: ThorstenHans
- Created: 2023-04-18T13:04:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-18T13:17:48.000Z (over 1 year ago)
- Last Synced: 2024-04-14T04:43:57.684Z (7 months ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Book API built with Fermyon Spin
This repository contains an HTTP API for managing books. The app is used to explain the new built-in HTTP router provided by Fermyon Spin 1.1.
## Running the Sample
You must have Rust, the `wasm32-wasi` target, and Spin CLI (`v1.1`) installed on your machine.
```bash
# build the app
spin build# run the app
spin up##
## alternative approach is to use
spin build --up
```## Provided API endpoints
- `GET /` - Return all books
- `GET /:id` - Return a book by its id
- `POST /` - Create a new book
- `PUT /:id` - Update a book by its id
- `DELETE /:id` - Delete a book by its idCheck the `src/models/book.rs` to see actual schema for request payloads and response bodies.
## Further details
To get further details on that sample, consider reading my [corresponding blog post](https://www.thorsten-hans.com/first-glance-at-spin-router-for-rust/).