Coder Social home page Coder Social logo

scratch-maven-react's Introduction

scratch-maven-react

This project demonstrates how to integrate Maven, Spring Boot, and React within the same project. This allows both the frontend and backend to be built together with Maven.

Building

To build this project simple use the following command:

mvn clean verify

This will build and test both the Java and JavaScript code. The JavaScript React code is built using the frontend-maven-plugin, which downloads then installs Node and NPM, retrieves all the JavaScript dependencies with NPM, builds the code with Webpack, then lastly runs all the tests with Karma.

The JavaScript project is setup as normal so can also be built with the traditional tools.

npm install
webpack
karma start

Technologies Demonstrated

frontend-maven-plugin

This Maven plugin is used to run all the JavaScript build tools. It's configuration is in the pom.xml.

NPM

NPM is used to retrieve all the JavaScript dependencies.

Webpack

The Webpack build tool is used to compile and build the React project. This includes checking the code style with ESLint and compiling the SASS into CSS.

'webpack-profiles' are used to provide the different configurations between the 'dev' and 'prod' builds.

Karma

The tests are run with Karma which has also been configured to carry out code coverage analyses. Additional configuration has been added to allow Karma to support the Enzyme test library which is used the test to React components.

The 'redux-mock-store' is used to carry out JavaScript unit tests on React components that have been bound to Redux.

The 'inject-loader' is used to mock ES6 imports so that individual JavaScript files can be tested in isolation.

'fetch-mock' has been used to mock fetch requests to allow the unit testing of functions that make HTTP requests to the backend.

React

The main purpose of this project is to demonstrate a simple near real world React build. So naturally the view layer is written in React. A few extra packages have been added in addition to React to bring the application closer to what would be expected in a real world scenario.

'react-router' has been used to create URL mappings to React components.

'redux' has been used to store the global application state and trigger React component renders on related state changes.

'redux-persist' has been used to persist the application state between browser refreshes.

'fetch-intercept' has been used to display the login page whenever a forbidden response is recieved by a fetch request.

scratch-maven-react's People

Contributors

shiver-me-timbers avatar

Watchers

Karl Bennett 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.