11= embedded-mongodb
22
3- Sample Helidon MP project that includes multiple REST operations.
3+ Sample Helidon MP project that includes multiple REST operations for managing products .
44
55== Build and Run
66
@@ -16,23 +16,35 @@ java -jar target/embedded-mongodb.jar
1616Basic:
1717[source,bash]
1818----
19- curl -X GET http://localhost:8080/simple-greet
20- Hello World!
19+ curl -X GET http://localhost:8080/products
2120----
2221
2322JSON:
2423[source,bash]
2524----
26- curl -X GET http://localhost:8080/greet
27- {"message":"Hello World!"}
28-
29- curl -X GET http://localhost:8080/greet/Joe
30- {"message":"Hello Joe!"}
31-
32- curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http://localhost:8080/greet/greeting
33-
34- curl -X GET http://localhost:8080/greet/Jose
35- {"message":"Hola Jose!"}
25+ # Create a product
26+ curl -X POST -H "Content-Type: application/json" -d '{
27+ "name": "Smartphone",
28+ "manufacturer": {
29+ "name": "Tech Co",
30+ "address": "1234 Tech Street",
31+ "contactNumber": "+123456789"
32+ },
33+ "tags": ["mobile", "smart"],
34+ "categories": [
35+ {"name": "Electronics", "description": "Devices and gadgets."},
36+ {"name": "Gadgets", "description": "Small useful tools and devices."}
37+ ]
38+ }' http://localhost:8080/products
39+
40+ # Get all products (paginated)
41+ curl -X GET http://localhost:8080/products?page=1&size=10
42+
43+ # Get a specific product by ID
44+ curl -X GET http://localhost:8080/products/{id}
45+
46+ # Delete a product by ID
47+ curl -X DELETE http://localhost:8080/products/{id}
3648----
3749
3850== Try Health
0 commit comments