|
1 | 1 | # RESTful API server app with Java Spring Reactive Framework |
2 | 2 | A light-weight RESTful API server starter app built with Java Spring Reactive Framework, MongoDB, WebFlux and Gradle. |
3 | 3 |
|
4 | | -### Running the App with Docker |
5 | | -Use the below to run mongoDB and the app on docker containers. |
| 4 | +### Running everything on Docker: |
| 5 | +Using ```docker-compose``` run both mongoDB and the app as docker containers. |
6 | 6 | ``` |
7 | 7 | ./gradlew clean build |
8 | 8 | docker-compose up |
9 | 9 | ``` |
10 | 10 |
|
11 | | -### Running the App without Docker |
| 11 | +### Not familiar with Docker? No problem run it locally on your machine: |
12 | 12 | For this you will need to set up the MongoDB Locally on your machine(Refer the Local MongoDB Setup section towards the end.). |
13 | | -Add the configurations in ```application.properties``` |
| 13 | +Add the configurations in ```application.properties``` and run the below or use your fav IDE: |
14 | 14 | ``` |
15 | 15 | ./gradlew clean build |
16 | 16 | ./gradlew bootRun |
17 | 17 | ``` |
18 | 18 |
|
19 | | -### Try the CRUD - Use cURL to access / test the APIs. |
20 | | -Once the server is running try the following APIs: |
| 19 | +### Try the CRUD. Test the endPoints / REST APIs. |
| 20 | +Once the server is running try to access the below APIs using ```cURL``` or ```POSTMAN``` or any tool that you are already using. |
21 | 21 |
|
| 22 | +CREATE: |
| 23 | +```POST``` /api/add |
22 | 24 |
|
23 | | -GET /api/get |
24 | 25 | ``` |
25 | | -curl http://localhost:4000/api/get |
| 26 | +curl -X POST -d '{"name":"Giri Jeedigunta","email":"giri@yopmail.com"}' -H "Content-Type: application/json" http://localhost:4000/api/add -v |
26 | 27 | ``` |
27 | 28 |
|
28 | | -GET /api/get/{email} |
29 | | - |
| 29 | +READ: |
| 30 | +```GET``` /api/get |
30 | 31 | ``` |
31 | | -curl http://localhost:4000/api/get/{email} |
| 32 | +curl http://localhost:4000/api/get |
32 | 33 | ``` |
33 | 34 |
|
34 | | -POST /api/add |
| 35 | +```GET``` /api/get/{email} |
35 | 36 |
|
36 | 37 | ``` |
37 | | -curl -X POST -d '{"name":"Giri Jeedigunta","email":"giri@yopmail.com"}' -H "Content-Type: application/json" http://localhost:4000/api/add -v |
| 38 | +curl http://localhost:4000/api/get/{email} |
38 | 39 | ``` |
39 | 40 |
|
40 | | -POST /api/udpate/{id} |
| 41 | +UPDATE: |
| 42 | +```POST``` /api/udpate/{id} |
41 | 43 |
|
42 | 44 | ``` |
43 | 45 | curl -X POST -d '{"name":"Giri J","email":"giri@giri.com"}' -H "Content-Type: application/json" http://localhost:4000/api/update/5f85c2c8b0abe7062019dd16 |
44 | 46 | ``` |
45 | 47 |
|
46 | | -POST /api/delete/{id} |
| 48 | +DELETE: |
| 49 | +```POST``` /api/delete/{id} |
47 | 50 |
|
48 | 51 | ``` |
49 | 52 | curl -X POST http://localhost:4000/api/delete/5f85c2c8b0abe7062019dd16 |
|
0 commit comments