Skip to content

cobbinma/example-rust-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example-rust-api

This is an example Rust REST API using Tide and SQLX.

To run you must have rust installed.

  1. Run docker-compose up to start Postgres database
  2. Use cargo run to start API
  3. Make a POST request to http://localhost:8181/pet with a request body (shown below) to add a pet
  4. Make a GET request to http://localhost:8181/pets to get a list of pets
  5. Make a GET request to http://localhost:8181/pet/:id to get an individual pet

Example request body to add a pet (an additional tag field is optional)

{
	"id": 1,
	"name": "Ben"
}

Make a GET request to http://localhost:8181/oas for the full API schema

Use cargo test to run tests

About

example rust api 🦀

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published