A simple application demonstrating React together with Spring Boot and Typescript
This repository consists of two projects.
- React frontend
- Spring Boot backend.
A simple demo app written with React, RXJS, Redux and Typescript.
This application demonstrates some of the key concepts. Although it is a simple application it has been written as if it was to be developed into a larger application.
The code is fully typed using Typescript types.
This React application makes use of RXJS for all async calls and redux for application state management. The calls to the RXJS library are contained within the epics under the redux/epics
directory. Once an RXJS epics is registered, each action which calls it makes the request to the backend API. Once the response is received the epic sends a new action to the relevant reducer found in the redux/reducers
directory. State is always updated from the reducer (and not the epics).
In the terminal clone this repository into directory of your choice. Navigate in the termal to the newly cloned project directory.
Run the following command
npm install
The application should now be installed and ready for action.
NOTE: Because there is no yarn.lock
file running yarn install
won't work.
First, ensure that the backend API is up an running. Find it here
npm start
Navigate to http://localhost:3000
Thee GET
method endpoints
/books/
: List all the books./books/{id}
: Find a book by ID./books/search/{search term}
: Search for a book by title or author name.
Runs on port 8080
.
For example: http://localhost:8080/books/
Ensure you have Java 1.8+ installed.
Clone this repository into a directory of your choice. Once cloned, switch into the new project directory and run:
mvn package
This will install dependencies, run the tests and package the application into a jar inside the target
directory.
Alternatively, just open the newly cloned project in IntelliJ and install the dependencies.
Data is automatically loaded when the application runs. Uses an H2 in memory database. Nothing to do here.
Note: There should be nothing to do here.
Ensure you have Java 1.8+ installed.
From inside the project directory run the following command:
java -jar ./target/backend-0.0.1-SNAPSHOT.jar
This is a SpringBoot application. Import the project into IntelliJ and from the src/main/java
directory
simply run the com.jthelsinki.backend.BackendApplication
class.
Once running, open the client side application (a seperate project) and start making requests.