Skip to content

easybird/playground-spring-react-isomorphic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Isomorphic React with Spring boot

Start

Tech stack

  • Java Spring Boot Backend
  • Server side rendered frontend with isomorphic React (rendered via .ejs template view engine).
  • Progressively enhanced (works without javascript)
  • Using Server Sent emitters when javascript is enabled, using post/redirect when javascript is disabled (without noticing any difference in the frontend)

Setup

  • Gradle for Java back-end
  • Npm & webpack for bundling Javascript (instead of the default WebJars used in Java/Gradle)

Prerequisites

  • Be sure to use JDK 8u60 or later in order to have the better Nashorn version available.

Plusses

  • Reusing front-end javascript validation files in the back-end becomes possible
  • Serverside rendering of modern javascript libraries/frameworks (like React) becomes possible in Java
  • Usage of - easy to implement - Server Sent Emitters in stead of Sockets..for one way communication only

Downsides, or things to improve:

  • Performance of Nashorn for rendering seems very slow
  • TO DO: use J2V8 in stead of Nashorn

Links used to make this possible:

How to Use javascript in java

Isomorphic Webapps on the JVM with React.js and Spring Boot

Server Sent Events

Spring-react-isomorphic presentation

Webjars

Integrate webpack and npm in this setup

Script template views in spring + J2V8 in stead of Nashorn

More details about Spring Script Templating in Spring Framework reference manual.

Releases

No releases published

Packages

No packages published

Languages

  • Java 50.2%
  • JavaScript 37.8%
  • HTML 11.3%
  • CSS 0.7%