Giter Club home page Giter Club logo

spring-five-functional-reactive's Introduction

Spring 5 - Functional, reactive web example

This repository contains the sample code for Spring WebFlux’s functional web API and consists of the following building blocks:

A sample for Spring WebFlux

  1. An Event domain type and a corresponding repository exposing a tailable query method.

  2. An ApplicationRunner that creates a capped collection for events and inserts a new one every two seconds.

  3. A Spring WebFlux controller to produce both a Server-Sent Events and JSON stream.

A sample for Spring WebFlux.fn

  1. A User domain type and a reactive repository mapped using Spring Data MongoDB.

  2. A FunctionalWebController to contain handler functions.

  3. An @Bean-Definition for a RouterFunction that uses the functional API to configure the mappings of requests to the FunctionalWebController.

How to run the sample

$ git clone https://github.com/olivergierke/spring-five-functional-reactive
$ cd spring-five-functional-reactive
$ ./mvnw spring-boot:run

# To see the events inserted on the server streaming to the client
$ curl -H "Accept: text/event-stream" http://localhost:8080/events

# To trigger the functional controller
$ curl http://localhost:8080/users

spring-five-functional-reactive's People

Contributors

odrotbohm avatar

Watchers

James Cloos avatar

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.