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.

75 lines
1.2 KiB

4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
  1. Testing out the Rust framework Actix-Web to create a JSON API CRUD Web App.
  2. ## API Demo
  3. ### Get Users
  4. ```
  5. curl -X GET http://localhost:7800/api/users
  6. ```
  7. ```
  8. {
  9. "name": "user1",
  10. "registration_date": "2020-05-09T06:17:26"
  11. }
  12. ```
  13. ```
  14. curl -X GET http://localhost:7800/api/users
  15. ```
  16. ```
  17. [
  18. {
  19. "name": "user1",
  20. "registration_date": "2020-05-09T06:17:26"
  21. },
  22. {
  23. "name": "user2",
  24. "registration_date": "2020-05-12T12:43:13"
  25. },
  26. {
  27. "name": "user3",
  28. "registration_date": "2020-05-15T07:47:50"
  29. }
  30. ]
  31. ```
  32. ### Create User
  33. ```
  34. curl -H "content-type: application/json" \
  35. -X PUT \
  36. -i http://localhost:7800/api/users \
  37. --data '{"name":"user4","password":"test"}'
  38. ```
  39. ```
  40. [
  41. {
  42. "name": "user1",
  43. "registration_date": "2020-05-09T06:17:26"
  44. },
  45. {
  46. "name": "user2",
  47. "registration_date": "2020-05-12T12:43:13"
  48. },
  49. {
  50. "name": "user3",
  51. "registration_date": "2020-05-15T07:47:50"
  52. },
  53. {
  54. "name": "user4",
  55. "registration_date": "2020-08-01T05:04:05"
  56. }
  57. ]
  58. ```
  59. ## Memory Usage
  60. 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.
  61. ## License
  62. AGPLv3