-
Notifications
You must be signed in to change notification settings - Fork 0
Update README #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a7f0811
README: Remove -p 8000:8000 from docker run params
mateumann 110c608
Revert "README: Remove -p 8000:8000 from docker run params"
mateumann 0301e24
Alternate take to Docker networking
mateumann 8f92860
Introduce FACTORY_IP_ADDRESS in the examples
mateumann 6a84c27
Remove application responses from README
mateumann 716cbaa
Update README.md
PiPPiPPoland 66491f0
Some more README updates
mateumann 953f300
Add a note about UUIDv4 values
mateumann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,34 +16,41 @@ docker build -t factory:local . | |
| Once you have an image built, run it like | ||
|
|
||
| ```sh | ||
| docker run --rm --name factory --network=host -p 8000:8000 factory:local | ||
| docker run --rm --name factory -p 8000:8000 factory:local | ||
| ``` | ||
|
|
||
| This snippet is intended just for testing the app, it is usually not a good | ||
| idea to run any containers like that in production. | ||
|
|
||
| ## Testing it | ||
|
|
||
| By default Docker container would probably start in `bridge` network mode (that | ||
| depends on your configuration), to find its IP address please run something like | ||
|
|
||
| ```sh | ||
| docker inspect factory | grep IPAddress | ||
| ``` | ||
|
|
||
| In another terminal window simple `curl` can be used to test the application, e.g. | ||
|
|
||
| ### Creating new materials (oxygen, hydrogen and sulphur) | ||
| ```sh | ||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{"name": "Oxygen", "quantity_unit": "mole"}' \ | ||
| http://localhost:8000/materials/ | ||
| http://172.20.0.2:8000/materials/ | ||
|
|
||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{"name": "Hydrogen", "quantity_unit": "mole"}' \ | ||
| http://localhost:8000/materials/ | ||
| http://172.20.0.2:8000/materials/ | ||
|
||
|
|
||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{"name": "Sulphur", "quantity_unit": "mole"}' \ | ||
| http://localhost:8000/materials/ | ||
| http://172.20.0.2:8000/materials/ | ||
| ``` | ||
|
|
||
| ### Listing materials | ||
| ```sh | ||
| curl -s http://localhost:8000/materials/ | jq | ||
| curl -s http://172.20.0.2:8000/materials/ | jq | ||
| [ | ||
| { | ||
| "name": "Oxygen", | ||
|
|
@@ -70,12 +77,12 @@ curl -s http://localhost:8000/materials/ | jq | |
| ```sh | ||
| curl -X PATCH -H "Content-Type: application/json" \ | ||
| -d '{"quantity_unit": "µg"}' \ | ||
| http://localhost:8000/materials/sulphur | ||
| http://172.20.0.2:8000/materials/sulphur | ||
| ``` | ||
|
|
||
| ### Fetching information about a single material | ||
| ```sh | ||
| curl -s http://localhost:8000/materials/sulphur | jq | ||
| curl -s http://172.20.0.2:8000/materials/sulphur | jq | ||
| { | ||
| "name": "Sulphur", | ||
| "slug": "sulphur", | ||
|
|
@@ -90,21 +97,21 @@ curl -s http://localhost:8000/materials/sulphur | jq | |
|
|
||
| ### Removing a material | ||
| ```sh | ||
| curl -X DELETE http://localhost:8000/materials/sulphur | ||
| curl -X DELETE http://172.20.0.2:8000/materials/sulphur | ||
| ``` | ||
|
|
||
| ### Creating a warehouse | ||
| ```sh | ||
| curl -X POST -H "Content-Type: application/json" \ | ||
| -d '{"name": "Chemicals-1", "location": "Wien", "max_capacity": 1000000}' \ | ||
| http://localhost:8000/warehouses/ | ||
| http://172.20.0.2:8000/warehouses/ | ||
| ``` | ||
|
|
||
| other operations look just like operations on materials, e.g. fetching | ||
| information about a single warehouse would be | ||
|
|
||
| ```sh | ||
| curl -s http://localhost:8000/warehouses/chemicals-1 | jq | ||
| curl -s http://172.20.0.2:8000/warehouses/chemicals-1 | jq | ||
| { | ||
| "name": "Chemicals-1", | ||
| "slug": "chemicals-1", | ||
|
|
@@ -124,14 +131,14 @@ curl -X POST -H "Content-Type: application/json" \ | |
| "positions": [{"material_id": "699139c4-eb11-4815-9021-2c8f66b38d5f", | ||
| "quantity": 10}, {"material_id": "c18605cd-3e1e-4898-8192-1da5662bc30a", \ | ||
| "quantity": 20}]}' \ | ||
| http://localhost:8000/delivery/ | ||
| http://172.20.0.2:8000/delivery/ | ||
| ``` | ||
|
|
||
| Delivered materials stored in a warehouse will diminish its capacity, so after | ||
| testing a delivery something will change, e.g. | ||
|
|
||
| ```sh | ||
| curl -s http://localhost:8000/warehouses/chemicals-1 | jq | ||
| curl -s http://172.20.0.2:8000/warehouses/chemicals-1 | jq | ||
| { | ||
| "name": "Chemicals-1", | ||
| "slug": "chemicals-1", | ||
|
|
@@ -158,7 +165,7 @@ curl -s http://localhost:8000/warehouses/chemicals-1 | jq | |
| ``` | ||
|
|
||
| ```sh | ||
| curl -s http://localhost:8000/materials/oxygen | jq | ||
| curl -s http://172.20.0.2:8000/materials/oxygen | jq | ||
| { | ||
| "name": "Oxygen", | ||
| "slug": "oxygen", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IPAddress_from_grep