Commit 9d7d38cd authored by 0Tyler's avatar 0Tyler

feat: readme init

parent 7f6bbb44
# EC Simple
## Docker Command:
電商情境程式,教學用途
## API
- [swagger.ec.yml](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/e1cf4aac-05c6-4054-b028-f0f7c48c9465/swagger.ec.yml?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220718%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220718T121916Z&X-Amz-Expires=86400&X-Amz-Signature=fd8501baf1c5d6d58d01e3924f69cf2708762feffbc5c6eab547fd4e686c0183&X-Amz-SignedHeaders=host&response-content-disposition=filename%20%3D%22swagger.ec.yml%22&x-id=GetObject)
## 啟動服務
進入專案資料夾,即可將服務啟動
```
sudo docker build -t ec-simple .
sudo docker run -p 7168:7168 ec-simple
```
\ No newline at end of file
```
## Postman
可以將 [/postman](/postman) 目錄下的 Collection 匯入至 postman 進行簡易測試,包含:
- [EC.postman_collection.json](postman/EC.postman_collection.json)
- API的集合
- [EC.postman_environment.json](postman/EC.postman_environment.json)
- API環境變數檔 (不匯入也可以,只有一個用於登入的 `token` 參數)
\ No newline at end of file
{
"info": {
"_postman_id": "9258f889-5c7a-4e9b-b60a-c47a87d0eebf",
"name": "EC",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "1690915"
},
"item": [
{
"name": "Login",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var data = pm.response.text();\r",
"pm.environment.set(\"token\", data);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"user1\",\r\n \"password\": \"1234\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:7168/api/login",
"protocol": "http",
"host": [
"localhost"
],
"port": "7168",
"path": [
"api",
"login"
]
}
},
"response": []
},
{
"name": "Product by id",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:7168/api/product/62734a1e-ef43-4ed4-a98a-71fee6dddeba",
"protocol": "http",
"host": [
"localhost"
],
"port": "7168",
"path": [
"api",
"product",
"62734a1e-ef43-4ed4-a98a-71fee6dddeba"
]
}
},
"response": []
},
{
"name": "Item by Product",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:7168/api/product",
"protocol": "http",
"host": [
"localhost"
],
"port": "7168",
"path": [
"api",
"product"
]
}
},
"response": []
},
{
"name": "Products",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "[\r\n \"tag3\"\r\n]",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:7168/api/product",
"protocol": "http",
"host": [
"localhost"
],
"port": "7168",
"path": [
"api",
"product"
]
}
},
"response": []
},
{
"name": "Checkout",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"lineItems\": [\r\n {\r\n \"sku\": \"16f37131-f5aa-4b21-8582-bf8708a1c6be\",\r\n \"quantity\": 3\r\n }\r\n ],\r\n \"email\": \"[email protected]\",\r\n \"creditCard\": \"test_card\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:7168/api/checkout",
"protocol": "http",
"host": [
"localhost"
],
"port": "7168",
"path": [
"api",
"checkout"
]
}
},
"response": []
}
]
}
\ No newline at end of file
{
"id": "43e4268b-4612-4d2e-b9d7-83094dfe3474",
"name": "EC",
"values": [
{
"key": "token",
"value": "",
"type": "default",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2022-07-18T12:24:24.827Z",
"_postman_exported_using": "Postman/9.24.2"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment