1
0
mirror of https://github.com/actix/examples synced 2025-06-27 01:27:43 +02:00

improve mysql readme

This commit is contained in:
Rob Ede
2023-07-18 01:01:26 +01:00
parent f3cf37bb0d
commit 048f4fd884
13 changed files with 168 additions and 216 deletions

View File

@ -0,0 +1,34 @@
# Banks API
All examples show cURL and [HTTPie](https://httpie.io/cli) snippets.
## Adding A Bank
```sh
curl -d '{"bank_name":"Bank ABC","country":"Kenya"}' -H 'Content-Type: application/json' http://localhost:8080/bank
http POST :8080/bank bank_name="Bank ABC" country="Kenya"
```
You should expect a 204 No Content response.
## Listing Banks
```sh
curl http://localhost:8080/bank
http :8080/bank
```
The response should be a 200 OK with the following JSON body:
```json
{
"bank_data": [
{
"bank_name": "bank abc",
"country": "kenya"
}
]
}
```

View File

@ -1,41 +0,0 @@
1.
Linux
curl -d '{"bank_name":"Bank ABC","country":"Kenya"}' -H 'Content-Type: application/json' http://127.0.0.1:8080/bank
2.
Windows
curl -H "Content-type:application/json" --data-binary "{\"bank_name\":\"Bank ABC\",\"country\":\"Kenya\"}" http://127.0.0.1:8080/bank
3.
JSON response
{
"status_code": 0,
"status_description": "Successful"
}
4.
Linux
curl 'http://localhost:8080/bank'
5.
Windows
curl http://localhost:8080/bank
6.
JSON response
{
"status_code": 0,
"status_description": "Successful",
"bank_data": [
{
"bank_name": "bank abc",
"country": "kenya"
}
]
}

View File

@ -0,0 +1,34 @@
# Branches API
All examples show cURL and [HTTPie](https://httpie.io/cli) snippets.
## Adding A Branch
```sh
curl -d '{"branch_name":"HQ branch", "location":"Central Business District"}' -H 'Content-Type: application/json' http://localhost:8080/branch
http POST :8080/branch branch_name="HQ branch" branch_name="Central Business District"
```
You should expect a 204 No Content response.
## Listing Branches
```sh
curl http://localhost:8080/branch
http :8080/branch
```
The response should be a 200 OK with the following JSON body:
```json
{
"branch_data": [
{
"branch_name": "hq branch",
"location": "central business district"
}
]
}
```

View File

@ -1,42 +0,0 @@
1.
Linux
curl -d '{"branch_name":"HQ branch", "location":"Central Business District"}' -H 'Content-Type: application/json' http://127.0.0.1:8080/branch
2.
Windows
curl -H "Content-type:application/json" --data-binary "{\"branch_name\":\"HQ branch\", \"location\":\"Central Business District\"}" http://127.0.0.1:8080/branch
3.
JSON response
{
"status_code": 0,
"status_description": "Successful"
}
4.
Linux
curl 'http://localhost:8080/branch'
5.
Windows
curl http://localhost:8080/branch
6.
JSON response
{
"status_code": 0,
"status_description": "Successful",
"branch_data": [
{
"branch_name": "hq branch",
"location": "central business district"
}
]
}

View File

@ -0,0 +1,34 @@
# Customers API
All examples show cURL and [HTTPie](https://httpie.io/cli) snippets.
## Adding A Customer
```sh
curl -d '{"customer_name":"Peter Paul", "branch_name":"Central Business District"}' -H 'Content-Type: application/json' http://localhost:8080/customer
http POST :8080/customer customer_name="Peter Paul" branch_name="Central Business District"
```
You should expect a 204 No Content response.
## Listing Customers
```sh
curl http://localhost:8080/customer
http :8080/customer
```
The response should be a 200 OK with the following JSON body:
```json
{
"customer_data": [
{
"customer_name": "peter paul",
"branch_name": "central business district"
}
]
}
```

View File

@ -1,42 +0,0 @@
1.
Linux
curl -d '{"customer_name":"Peter Paul", "branch_name":"Central Business District"}' -H 'Content-Type: application/json' http://127.0.0.1:8080/addcustomer
2.
Windows
curl -H "Content-type:application/json" --data-binary "{\"customer_name\":\"Peter Paul\", \"branch_name\":\"Central Business District\"}" http://127.0.0.1:8080/addcustomer
3.
JSON response
{
"status_code": 0,
"status_description": "Successful"
}
4.
Linux
curl 'http://localhost:8080/customer'
5.
Windows
curl http://localhost:8080/customer
6.
JSON response
{
"status_code": 0,
"status_description": "Successful",
"customer_data": [
{
"customer_name": "peter paul",
"branch_name": "central business district"
}
]
}

View File

@ -0,0 +1,34 @@
# Tellers API
All examples show cURL and [HTTPie](https://httpie.io/cli) snippets.
## Adding A Teller
```sh
curl -d '{"teller_name":"John Doe", "branch_name":"Central Business District"}' -H 'Content-Type: application/json' http://localhost:8080/teller
http POST :8080/teller teller_name="John Doe" branch_name="Central Business District"
```
You should expect a 204 No Content response.
## Listing Tellers
```sh
curl http://localhost:8080/teller
http :8080/teller
```
The response should be a 200 OK with the following JSON body:
```json
{
"teller_data": [
{
"teller_name": "john doe",
"branch_name": "central business district"
}
]
}
```

View File

@ -1,42 +0,0 @@
1.
Linux
curl -d '{"teller_name":"John Doe", "branch_name":"Central Business District"}' -H 'Content-Type: application/json' http://127.0.0.1:8080/teller
2.
Windows
curl -H "Content-type:application/json" --data-binary "{\"teller_name\":\"John Doe\", \"branch_name\":\"Central Business District\"}" http://127.0.0.1:8080/teller
3.
JSON response
{
"status_code": 0,
"status_description": "Successful"
}
4.
Linux
curl 'http://localhost:8080/teller'
5.
Windows
curl http://localhost:8080/teller
6.
JSON response
{
"status_code": 0,
"status_description": "Successful",
"teller_data": [
{
"teller_name": "john doe",
"branch_name": "central business district"
}
]
}