Skip to content

This is an API developed with Rust, Rocket & Diesel and was created in order to study Rust. Therefore, the code might not be one of the best since I'm still a noob :D.

Notifications You must be signed in to change notification settings

wpdas/blog-api-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog Api - Rust

This is an API developed with Rust, Rocket & Diesel and was created in order to study Rust. Therefore, the code might not be one of the best since I'm still a noob :D.

Executing

2 - Install diesel if you haven't yet:

cargo install diesel_cli --no-default-features --features postgres

3 - Run the container:

docker compose up

4 - Create the tables:

diesel migration run

5 - Run the app:

cargo run

Postman

Posting a new content.

POST: http://localhost:8000/post

Body example:

{
  "title": "My First Post",
  "body": "The awesome body of my first post! :D"
}

Fetching posts.

GET: http://localhost:8000/posts

Good to know

If you face the Id: library not found for -lpq. Access this site to get to know how to fix it.

Tips

diesel setup: Initializes the migrations setup for diesel

diesel migration generate posts: Generates posts migration table

diesel migration run: Runs migration codes

diesel migration redo: It's going to execute the down.sql and up.sql file again in order to redo the migration.

About

This is an API developed with Rust, Rocket & Diesel and was created in order to study Rust. Therefore, the code might not be one of the best since I'm still a noob :D.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published