Skip to content

joerodriguez/spring-angular2-component-based

Repository files navigation

Spring Angular2 Component based

An example project using Spring (component-based) and Angular 2.

Dependencies

Setup

  1. Install Firefox: https://www.mozilla.org/en-US/firefox/new/
  2. Install postgres: brew install postgres
  3. Follow instructions to start postgres now and on restart
  4. Create a postgres database super user admin with password 'admin': createuser admin --superuser --password
  5. Create postgres databases: createdb spring-ng2-example && createdb spring-ng2-example-test
  6. mkdir -p deployment/example-api/src/resources
  7. cp applications/example-api/src/resources/application.yml.example deployment/example-api/src/resources/application.yml

Running

  1. Create a test user [email protected] PASSWORD=test123 ./gradlew :applications/example-api:runAppTask -PtaskName=createUser
  2. Run migrations with the following command: ./gradlew flywayMigrate -Dflyway.user=admin -Dflyway.password=admin -Dflyway.url=jdbc:postgresql://localhost/spring-ng2-example
  3. gradle bootRun
  4. Navigate to http://localhost:8080/
  5. Check out http://localhost:8080/swagger-ui.html to see all functionality of the backend.

Front end development

The front end build has a few node tasks that will help when developing locally. To get started run the npmInstall gradle task followed by the run gradle task. Run will compile, setup watchers for ts and scss files, and open a browser with browser-sync enabled.

Running tests

  1. ./gradlew :applications/example-api:migrateTestDatabase
  2. ./gradlew clean test