hello-angular2-universal-j2v8
hello-angular2-universal-j2v8 copied to clipboard
A simple example of using angular-universal with java backend using J2V8
Angular-Universal with Java backend using J2V8
This repository contains a simple (and very initial) example of using angular-universal with java backend using J2V8.
##Features:
- Rendering using angular universal from java using J2V8
- Serving both the application and other rest endpoint from java using sparkjava
- Basic live-reload support for the universal server build
- Linux x64 only
- Multi-Node (each in its own thread) rendring
- Java level cache for increasing performance (using the cache assumes that the render function is pure)
- The renderer itself (not including the usage example) dependes on J2V8 and Guava
##TODO:
- Fetch J2V8 from maven central
- Support other platforms
- Performance tests
- Documentation and code-cleanup
- Orginize project structure
- Implement a more complex client side application
- ~~Check if can model the bootstrap configuration object in java in order to remove the need for server.js completely~~
- ~~Cleanup and improvement of the JavaEngine (currently almost blindly based on the expressEngine)~~
- ~~Remove the direct gson dependency~~
- ~~Expose the cache through configuration~~
- ~~Make the configuration object api fluid~~
##Requirements
- x64 Linux (tested on ubuntu 16.04)
- Java 8
- Maven
- NPM
##Running Instructions
- Clone the repository
- Install node dependencies (
npm install
) - Build the java server(
mvn clean package
) - Build&Watch angular-universal + angular client side code (
npm start
) - Execute the java server (
mvn -e exec:java -Dexec.mainClass="hello.ngu.j2v8.Server"
) - Open your browser on
http://localhost:3000/app/
##Links
###Thanks and credits
- The Angular-Universal-related files are based on Angular 2 Universal starter kit with very small modifications
- Special thanks to @irbull for the great J2V8 library and he's help.