-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CartService: Add health check endpoint and update routes
Added a new HealthZ endpoint in the Cart Service that responds to HTTP GET requests with a 200 status. Also restructured the existing routes for clarity and better organization, prefixing all cart-related endpoints with '/cart'. Finally, updated the .http file to reflect these changes.
- Loading branch information
Showing
3 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,14 +1,22 @@ | ||
GET http://localhost:8081/1/ | ||
GET http://localhost:8080/ | ||
Accept: application/json | ||
|
||
### | ||
PUT http://localhost:8081/1/ | ||
### Health probe | ||
GET http://localhost:8080/healthz | ||
Accept: application/json | ||
|
||
### Get cart with id=1 | ||
GET http://localhost:8081/cart/1/ | ||
Accept: application/json | ||
|
||
### Update cart with id=1 | ||
PUT http://localhost:8081/cart/1/ | ||
Content-Type: application/json | ||
|
||
{ | ||
"items": ["1", "2", "3"] | ||
} | ||
|
||
### | ||
DELETE http://localhost:8081/1/ | ||
### Delete cart with id=1 | ||
DELETE http://localhost:8081/cart/1/ | ||
Accept: application/json |
This file contains 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package handler | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"net/http" | ||
) | ||
|
||
func HealthZ(c *gin.Context) { | ||
c.Status(http.StatusOK) | ||
} |
This file contains 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