Skip to content

Commit

Permalink
feat: finish initial project
Browse files Browse the repository at this point in the history
  • Loading branch information
jayden-dang committed Jun 18, 2024
1 parent 63353e4 commit f22dbd3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ args = ["build"]

[tasks.dev]
command = "cargo"
args = ["run"]
args = ["watch", "-x", "build", "-x", "test", "-x" , "run"]

[tasks.test]
command = "cargo"
Expand Down
32 changes: 17 additions & 15 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
Welcome to Rust Monorepo Microservices, a framework designed to streamline the development of scalable microservice architectures in Rust using a monorepository approach.
#+end_quote

* Table of Contents :TOC:
- [[#overview][Overview]]
- [[#features][Features]]
- [[#get-started][Get Started]]
- [[#prerequisites][Prerequisites]]
- [[#installation][Installation]]
- [[#usage][Usage]]
- [[#contributing][Contributing]]
- [[#license][License]]
- [[#acknowledgments][Acknowledgments]]

* Overview
This project aims to provide developers with a cohesive toolkit for managing multiple microservices within a single repository. By adopting a monorepo strategy, it simplifies code sharing, improves modularity, and enhances overall project maintainability. Rust's performance and safety features are leveraged to ensure robustness and efficiency in distributed systems.

Expand All @@ -34,11 +23,19 @@ This project aims to provide developers with a cohesive toolkit for managing mul
* Get Started
** Prerequisites
+ Rust: Version 1.79.0
+ Node Package Manager: Bun Package Manager
#+begin_quote
curl -fsSL https://bun.sh/install | bash
#+end_quote
+ PostgreSQL

** Techstack
+ Axum - Http Method
+ Tokio - Concurrency
+ sqlx - seaORM: Query
+ bb8-redis - Redis
+ Opentelemetry - Tracing
+ gRPC - tonic/protobuf
+ AWS - EC2 / S3
+ Github Actions
+ RabbitMq

** Installation
+ Cargo Make:
#+begin_quote
Expand All @@ -50,6 +47,11 @@ cargo install cargo-make
cargo install cargo-nextest
#+end_quote

+ Cargo Watch
#+begin_quote
cargo install cargo-watch
#+end_quote

+ Build
#+begin_quote
cargo make build
Expand Down
16 changes: 6 additions & 10 deletions https.org
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
User-Agent: Emacs30"
#+END_SRC

#+RESULTS: headers
: Content-Type: application/json
: User-Agent: Emacs30

* API
** Index
#+BEGIN_SRC restclient :var host=host :var headers=headers
Expand All @@ -33,29 +29,29 @@ GET http://localhost:3000/
HTTP/1.1 200 OK
content-type: text/plain; charset=utf-8
content-length: 13
date: Fri, 14 Jun 2024 01:58:01 GMT
Request duration: 2.012351s
date: Tue, 18 Jun 2024 10:39:01 GMT
Request duration: 0.115446s
#+END_SRC

** User
#+BEGIN_SRC restclient :var host=host :var headers=headers
POST :host/users
:headers
{
"username" : "helloworld"
"username" : "jaydendang"
}
#+END_SRC

#+RESULTS:
#+BEGIN_SRC js
{
"id": 1337,
"username": "helloworld"
"username": "jaydendang"
}
// POST http://localhost:3000/users
// HTTP/1.1 201 Created
// content-type: application/json
// content-length: 35
// date: Fri, 14 Jun 2024 01:54:18 GMT
// Request duration: 0.021560s
// date: Tue, 18 Jun 2024 10:40:40 GMT
// Request duration: 0.017513s
#+END_SRC
10 changes: 1 addition & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,8 @@ async fn root() -> &'static str {
"Hello, World!"
}

async fn create_user(
// this argument tells axum to parse the request body
// as JSON into a `CreateUser` type
Json(payload): Json<CreateUser>,
) -> (StatusCode, Json<User>) {
// insert your application logic here
async fn create_user(Json(payload): Json<CreateUser>) -> (StatusCode, Json<User>) {
let user = User { id: 1337, username: payload.username };

// this will be converted into a JSON response
// with a status code of `201 Created`
(StatusCode::CREATED, Json(user))
}

Expand Down

0 comments on commit f22dbd3

Please sign in to comment.