Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Go-mazon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Albrecht
Go-mazon
Commits
683c8079
Commit
683c8079
authored
1 year ago
by
albrecht
Browse files
Options
Downloads
Patches
Plain Diff
erste readme version
parent
e10fb4b9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+92
-14
92 additions, 14 deletions
README.md
with
92 additions
and
14 deletions
README.md
+
92
−
14
View file @
683c8079
#
# gomazon
# gomazon
## Getting Started
### Start without Docker:
###
#
Start without Docker:
```
./scripts/start-mariadb.sh
# cd src/gomazon && go run main.go
```
### Build, Start and Stop service using Docker Compose
###
#
Build, Start and Stop service using Docker Compose
```
docker compose build
...
...
@@ -20,9 +20,9 @@ docker compose down
## All API Functions
In this section all API-Functions will be presented with an example call!
### BASIC FUNCTIONS
### GET JWT-Token
#### GET JWT-Token
Use the Result-Token for all marked API-Functions!
```
curl --location --request GET 'localhost:8080/createJWT' \
...
...
@@ -33,7 +33,15 @@ curl --location --request GET 'localhost:8080/createJWT' \
}'
```
### CREATE PRODUCT (Admin only)
#### Health Check
Function tests if the service is running.
```
curl --location 'localhost:8080/health'
```
### Product-Functions
#### CREATE PRODUCT (Admin only) (TOKEN REQUIRED)
```
curl --location 'localhost:8080/products' \
--header 'Content-Type: application/json' \
...
...
@@ -45,7 +53,7 @@ curl --location 'localhost:8080/products' \
}'
```
### UPDATE PRODUCT (Admin only)
###
#
UPDATE PRODUCT (Admin only)
(TOKEN REQUIRED)
```
curl --location --request PUT 'localhost:8080/products/1' \
--header 'Content-Type: application/json' \
...
...
@@ -57,24 +65,94 @@ curl --location --request PUT 'localhost:8080/products/1' \
}'
```
### DELETE PRODUCT (Admin only)
###
#
DELETE PRODUCT (Admin only)
(TOKEN REQUIRED)
```
curl --location --request DELETE 'localhost:8080/products/1' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE'
```
### GET ALL PRODUCTS
###
#
GET ALL PRODUCTS
```
curl --location 'localhost:8080/products'
```
### GET SINGLE PRODUCT
###
#
GET SINGLE PRODUCT
```
curl --location 'localhost:8080/products/1'
```
### Health Check
Function tests if the service is running.
### Rating-Functions
#### POST RATING (TOKEN REQUIRED)
```
curl --location 'localhost:8080/health'
```
\ No newline at end of file
curl --location 'localhost:8080/products/2/rating' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE' \
--data '{
"Content": "Great Product!",
"Rating": 5
}'
```
#### DELETE RATING (TOKEN REQUIRED)
Only Admins and Owner of the Rating can use this
```
curl --location --request DELETE 'localhost:8080/ratings/3' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE'
```
#### READ ALL RATINGS
```
curl --location 'localhost:8080/ratings'
```
### Bankaccount-Functions
#### CREATE BANKACCOUNT (TOKEN REQUIRED)
If one user has already an account, the existing account is the result value.
```
curl --location 'localhost:8080/bankaccounts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE' \
--data '{
"iban": "DE1234",
"bankName": "Sparkasse",
"balance": 200.00
}'
```
#### Deposit or withdraw (TOKEN REQUIRED)
```
curl --location --request PUT 'localhost:8080/bankaccounts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE' \
--data '{
"amount": 50.0
}'
```
### ShoppingCart-Functions
#### CREATE SHOPPINGCART (TOKEN REQUIRED)
If one user has already an ShoppingCart, the existing ShoppingCart is the result value.
```
curl --location --request POST 'localhost:8080/ShoppingCart' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE'
```
#### ADD PRODUCT TO SHOPPINGCART (TOKEN REQUIRED)
```
curl --location 'localhost:8080/ShoppingCart/Product/1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE' \
--data '{
"amount": 3
}'
```
#### PAY SHOPPINGCART (TOKEN REQUIRED)
```
curl --location --request POST 'localhost:8080/ShoppingCart/pay' \
--header 'Authorization: Bearer INSERT_TOKEN_HERE'
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment