Skip to content

A project to learn about Rust using Surrealdb and Warp.

Notifications You must be signed in to change notification settings

kevinetore/rust-surrealdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Examples

A project to learn about Rust using (Surrealdb)[https://surrealdb.com/] and Warp.

Run the project

To get started, run cargo watch -q -c -x "run -q"

This will start a web server running on your localhost port 8080.

Open another terminal and run:

Get all available books

> curl http://localhost:8080/books
[]%

Create a book

> curl -o /dev/null -s -w "%{http_code}\n" --location --request GET 'http://localhost:8080/books' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "The Rust programming language",
    "author": "Steve Klabnik, Carol Nichols",
    "num_pages": 527,
    "tags": ["Ferris", "Rust"]
}'
201

List a book

> curl --location --request GET 'http://localhost:8080/books/ukonjk599zx0pfvwp868'
{
    "author": "Steve Klabnik, Carol Nichols",
    "created_at": "2023-08-17 19:11:02.309722 UTC",
    "id": "book:ukonjk599zx0pfvwp868",
    "name": "The Rust programming language",
    "num_pages": "527",
    "tags": [
        "Ferris",
        "Rust"
    ]
}

Delete a book

> curl --location --request DELETE 'http://localhost:8080/books/ukonjk599zx0pfvwp868'
200

About

A project to learn about Rust using Surrealdb and Warp.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages