###Spring-Boot-Create-React-App
Initial setup of your machine:
- Install Yarn
- Run
yarn global add flow-typed
- Install watchman
brew update && brew install watchman
Setup project:
- Clone the repo with project name:
git clone https://github.com/thomasbem/spring-boot-create-react-app.git <project_name>
cd <project_name>
- Run gradle setup:
./setup.sh
When adding new modules to package.json, run flow-typed install
. This fetches flow type definitions for npm modules if they exist.
Run front-end for development
cd <project_name>-web
- Run
yarn run start
to startup the front-end with a mock back-end using json-server - Navigate to localhost:3000
Build and run full stack
- Run
./gradlew
to build project cd <project_name>-api/build/libs/
- Type
java -jar
then tab to auto complete to latest version. First time this should be,java -jar <project_name>-0.0.1-SNAPSHOT.jar
How to deploy application to Heroku
- Create new app in Heroku
- Add .travis.yml to cloned project and replace project-name and heroku-app-name (See code block below)
- Push to Github and enabled TravisCI to build the project
- Add HEROKU_API_KEY environment variable to Travis with your HEROKU_API_TOKEN (Can be found in Heroku or using Heroku cli -
heroku auth:token)
language: java
jdk:
- oraclejdk8
env:
- NODE_VERSION=6
install:
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
- sudo apt-get install -y nodejs
- npm install -g yarn
- wget https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz
- tar -xf heroku-linux-amd64.tar.gz
- ./heroku/bin/heroku plugins:install heroku-cli-deploy
script:
- ./gradlew
- ./heroku/bin/heroku jar:deploy _project-name_-api/build/libs/*.jar --app _heroku-app-name_ HEROKU_API_KEY
Now go have fun!