dansoy/rust-api

REST API with Rust using Actix-Web 2

GET /users ➡ returns all users

.0

API Endpoints:
  • 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
  • actix-redis
  • actix-rt
  • actix-session
  • actix-web
  • chrono
  • derive_more
  • diesel
  • diesel_migrations
  • dotenv
  • env_logger
  • lazy_static
  • log
  • rand
  • rust-argon2
  • serde
  • serde_derive
  • serde_json
  • uuid

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

Information - Updated Oct 24, 2021

Stars: 3
Forks: 1
Issues: 0

Repositories & Extras

cargo-cov: Source coverage for Rust

cargo-cov is a cargo subcommand which performs source coverage collection and reporting for Rust crates

cargo-cov: Source coverage for Rust

cargo-raze: Bazel BUILD generation for Rust Crates

An experimental support Cargo plugin for distilling a workspace-level

cargo-raze: Bazel BUILD generation for Rust Crates

rust crates for parsing stuff

Tokenizers for math expressions, splitting text, lexing lisp-like stuff, etc

rust crates for parsing stuff

Rust crates for working with healthchecks

io pinging and management APIs

Rust crates for working with healthchecks

A collection of rust crates for an interpreter

The project contains the nyxx-lexer crate

A collection of rust crates for an interpreter

Rust Graphics Crates

This is an opinionated list of modern graphics crates in Rust

Rust Graphics Crates

Rust extensions for containerd

A collection of Rust crates to extend containerd

Rust extensions for containerd

A small and easy to use rust crate for logging

Add the dependency on simplogin your crate's Cargo

A small and easy to use rust crate for logging

This is my Rust / Macroquad game dev toolbox!

There's all kinds of tiny Rust crates in here, for a whole variety of things

This is my Rust / Macroquad game dev toolbox!

roc -- cli rust documentation that rocks

go doc style command line searching through documentation for rust crates

roc -- cli rust documentation that rocks
Facebook Instagram Twitter GitHub Dribbble
Privacy