|  | 
| 5 | 5 | ## info | 
| 6 | 6 | This is an example of doing reactive MicroServices using spring 5 functional web framework and spring boot 2. | 
| 7 | 7 | 
 | 
| 8 |  | -This service provide and API that will greet the user with a quote. | 
| 9 |  | - | 
|  | 8 | +This service provide and API that will get the geo location and the sunrise and sunset times from an address. | 
|  | 9 | + | 
|  | 10 | +```Gherkin | 
|  | 11 | +Scenario Get Location | 
|  | 12 | + Given I've an address | 
|  | 13 | + When I call the location service | 
|  | 14 | + Then I should get a geo location | 
|  | 15 | + And I should get the sunrise and sunset times | 
|  | 16 | +``` | 
| 10 | 17 | This example cover several topics:  | 
| 11 | 18 | 
 | 
| 12 | 19 | - Functional programing. | 
| @@ -34,17 +41,30 @@ $ mvnw spring-boot:run | 
| 34 | 41 | 
 | 
| 35 | 42 | ## Sample requests | 
| 36 | 43 | 
 | 
| 37 |  | -- GET [http://localhost:8080/api/greetings](http://localhost:8080/greetings) | 
|  | 44 | +Get from address | 
|  | 45 | +```shell | 
|  | 46 | +$ curl -X GET "http://localhost:8080/api/location/Trafalgar%20Square%2C%20London%2C%20England" -H "accept: application/json" | 
|  | 47 | +``` | 
| 38 | 48 | 
 | 
| 39 |  | -- GET [http://localhost:8080/api/greetings/reactive](http://localhost:8080/greetings/reactive) | 
|  | 49 | +Post from JSON | 
|  | 50 | +```shell | 
|  | 51 | +$ curl -X POST "http://localhost:8080/api/location" -H "accept: application/json" -H "content-type: application/json" -d "{ \"address\": \"Trafalgar Square, London, England\"}" | 
|  | 52 | +``` | 
| 40 | 53 | 
 | 
| 41 |  | -- POST [http://localhost:8080/api/greetings](http://localhost:8080/greetings)  | 
|  | 54 | +Both will produce something like: | 
|  | 55 | +```json | 
|  | 56 | +{ | 
|  | 57 | + "geographicCoordinates": { | 
|  | 58 | + "latitude": 51.508039, | 
|  | 59 | + "longitude": -0.128069 | 
|  | 60 | + }, | 
|  | 61 | + "sunriseSunset": { | 
|  | 62 | + "sunrise": "2017年05月21日T03:59:08+00:00", | 
|  | 63 | + "sunset": "2017年05月21日T19:55:11+00:00" | 
|  | 64 | + } | 
|  | 65 | +} | 
|  | 66 | +``` | 
| 42 | 67 | 
 | 
| 43 |  | - ```json | 
| 44 |  | - { | 
| 45 |  | - "name" : "json"  | 
| 46 |  | - } | 
| 47 |  | - ``` | 
| 48 | 68 | ## API | 
| 49 | 69 | [ View in the embedded Swagger UI](http://localhost:8080/index.html) | 
| 50 | 70 | 
 | 
|  | 
0 commit comments