1
1
= embedded-mongodb
2
2
3
- Sample Helidon MP project that includes multiple REST operations.
3
+ Sample Helidon MP project that includes multiple REST operations for managing products .
4
4
5
5
== Build and Run
6
6
@@ -16,23 +16,35 @@ java -jar target/embedded-mongodb.jar
16
16
Basic:
17
17
[source,bash]
18
18
----
19
- curl -X GET http://localhost:8080/simple-greet
20
- Hello World!
19
+ curl -X GET http://localhost:8080/products
21
20
----
22
21
23
22
JSON:
24
23
[source,bash]
25
24
----
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}
36
48
----
37
49
38
50
== Try Health
0 commit comments