You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Rohan Sircar 565e6bc5e4 Changes to ci 3 years ago
.github/workflows Changes to ci 3 years ago
db minor enhancements 3 years ago
migrations/2020-05-02-115427_create_users Many updates 4 years ago
src fix dockerfile 3 years ago
static first commit 4 years ago
templates first commit 4 years ago
.env minor enhancements 3 years ago
.gitignore minor enhancements 3 years ago
Cargo.lock many changes 3 years ago
Cargo.toml minor enhancements 3 years ago
README.md update readme 3 years ago
app.db minor enhancements 3 years ago
build.Dockerfile Changes to ci 3 years ago
build.Dockerfile.dockerignore Changes to ci 3 years ago
ci.Dockerfile Changes to ci 3 years ago
ci.Dockerfile.dockerignore Changes to ci 3 years ago
diesel.toml first commit 4 years ago
rustfmt.toml Implemented basic auth logic + other stuff 4 years ago

README.md

Testing out the Rust framework Actix-Web to create a JSON API CRUD Web App.

API Demo

Get Users

curl -X GET http://localhost:7800/api/users/get/1
{
  "name": "user1",
  "registration_date": "2020-05-09T06:17:26"
}
curl -X GET http://localhost:7800/api/users/get
[
  {
    "name": "user1",
    "registration_date": "2020-05-09T06:17:26"
  },
  {
    "name": "user2",
    "registration_date": "2020-05-12T12:43:13"
  },
  {
    "name": "user3",
    "registration_date": "2020-05-15T07:47:50"
  }
]

Create User

curl -H "content-type: application/json" \
-X POST \
-i http://localhost:7800/do_registration \
--data '{"name":"user4","password":"test"}'
[
  {
    "name": "user1",
    "registration_date": "2020-05-09T06:17:26"
  },
  {
    "name": "user2",
    "registration_date": "2020-05-12T12:43:13"
  },
  {
    "name": "user3",
    "registration_date": "2020-05-15T07:47:50"
  },
  {
    "name": "user4",
    "registration_date": "2020-08-01T05:04:05"
  }
]

DTO Validation

curl -H "content-type: application/json" \
-X POST \
-i http://localhost:7800/do_registration \
--data '{"name":"abc","password":"test"}' # min length for name is 4
ValidationErrors({"name": Field([ValidationError { code: "length", message: None, params: {"value": String("abc"), "min": Number(4), "max": Number(10)} }])})

Memory Usage

Memory usage as compared to interpreted languages was my primary motivation for looking into rust as a backend language. As of writing, the demo app uses less than 50MB of memory.