Giter Site home page Giter Site logo

learningbyexample / kotlinreactivems Goto Github PK

View Code? Open in Web Editor NEW
34.0 5.0 12.0 573 KB

An educational project to learn reactive programming with Spring 5 and Kotlin

License: MIT License

Shell 7.45% Batchfile 5.76% Kotlin 80.78% HTML 6.01%
java kotlin spring-boot spring5 spring-framework webflux reactive-programming reactive-microservices spring-webflux reactor api-rest apis microservices reactive spring reactive-streams spring-reactive flow

kotlinreactivems's Introduction

Kotlin Reactive Micro Services Example

License: MIT Build Status codecov codebeat badge

IntelliJ code coverage runner gives a 100%, unfortunately I've not managed to get the same results using codecov.io and JaCoCo

info

This is an example of doing reactive MicroServices using spring 5 functional web framework and spring boot 2 using Kotlin.

This is a fork of the original java version.

This service provide and API that will get the geo location and the sunrise and sunset times from an address.

Scenario: Get Location
  Given I've an address
  When I call the location service
  Then I should get a geo location
  And I should get the sunrise and sunset times

To implement this example we consume a couple of REST APIs.

This example cover several topics:

  • Functional programing.
  • Reactive types.
  • Router Functions.
  • Static Web-Content.
  • Creation on Reactive Java Services/Components.
  • Error handling in routes and services.
  • Reactive Web Client to consume external REST Services.
  • Organizing your project in manageable packaging.

Includes and in depth look to testing using JUnit5:

  • Unit, Integration and System tests.
  • Mocking, including reactive functions and JSON responses.
  • BDD style assertions.
  • Test tags with maven profiles.

Sample requests

Get from address

$ curl -X GET "http://localhost:8080/api/location/Trafalgar%20Square%2C%20London%2C%20England" -H  "accept: application/json"

Post from JSON

$ curl -X POST "http://localhost:8080/api/location" -H  "accept: application/json" -H  "content-type: application/json" -d "{  \"address\": \"Trafalgar Square, London, England\"}"

Both will produce something like:

{
  "geographicCoordinates": {
    "latitude": 51.508039,
    "longitude": -0.128069
  },
  "sunriseSunset": {
    "sunrise": "2017-05-21T03:59:08+00:00",
    "sunset": "2017-05-21T19:55:11+00:00"
  }
}

All date and times are ISO 8601 UTC without summer time adjustment

API

View in the embedded Swagger UI View in the embedded Swagger UI

Run in Postman Run in Postman

Project Structure

References

kotlinreactivems's People

Contributors

juan-medina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kotlinreactivems's Issues

Mocking framework

Hi,

hope find you well with this cold call.

I am an author of mocking framework for Kotlin

I see you are using mockito-kotlin.

I just want you to be aware that there is solution that fully supports Kotlin and ask to try it in your new/current projects.

I can help you if you answer to this issue.

Thanks and please star it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.