Skip to content

dansoy/rust-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST API with Rust using Actix-Web 2.0

API Endpoints:
  • GET /users ➡ returns all users
  • POST /users ➡ takes in a JSON payload and creates a new user based on it
  • PUT /users ➡ takes in a JSON payload and updates the user
  • GET /users/{id} ➡ returns the user with a given id
  • DELETE /users/{id} ➡ deletes the user with a given id
  • POST /register ➡ takes in a JSON payload and creates a new user based on it
  • POST /auth ➡ takes in a JSON payload for login
  • DELETE /auth ➡ for logout
  • Get /auth ➡ returns the user data if we are signed in and a status 401 if we are not
Crates Used

Dependencies

Install Diesel CLI:
  • Click here for reference on how to install diesel_cli
cargo install diesel_cli

How To Use

  • clone repository
git clone https://github.com/dansoy/rust-api project-name
  • cd into your project
cd project-name
  • create a copy of your .env file
cp .env.example .env
  • create an empty Mysql database and add your database details to the .env file
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
  • run server
cargo run

About

REST API with Rust using Actix-Web

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published