This project was generated with Angular CLI version 6.0.7.
- yarn version >= 1.7.0
- Java JDK >= 1.8
yarn add global @angular/cli
ng new hateoas-navigator-tutorial --routing=true
cd hateoas-navigator-tutorial
ng add @angular/material
ng add resource-components
Instead of running resource-components' ng-add schematic, you could also apply the following manually:
0. yarn add moment hateoas-navigator resource-components
0. Add the "proxyConfig" line to angular.json
0. Copy proxy.conf.json
0. In app.module.ts add the three imports
HalNavigatorModule.forRoot(undefined),
DocumentComponentsModule,
RouterModule.forRoot(GenericRoutes.get())
- Due to an angular issue, replace
GenericRoutes.get()
by the array it returns - Add the default navigation by replacing app.component.html with
<lib-navigation></lib-navigation>
<div id="cmp-content" class="mat-elevation-z2">
<router-outlet></router-outlet>
</div>
- Go to https://start.spring.io
- Choose the dependencies "Rest Repositories", "JPA" and "H2" ("Devtools" and "Lombok" if you wish)
- Generate Project, unzip the downloaded zip
- Optional: Add the patched version of Spring Data Rest to the pom.xml:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>3.1.9.RELEASE-FORK</version><!-- Fixes JsonSchema issue -->
</dependency>
</dependencies>
</dependencyManagement>
- Create an entity, example: Person.
Note: Currently HATEOAS Navigator requires a
@Version
in every root entity. - Create a repository, example: PersonRepository.
- Then start the backend:
./mvnw spring-boot:run
- Start the UI
ng serve
Now you can navigate to the previously created resource, create, list, edit and delete items.
If you have an association from one resource to another, define an excerpt projection to see the associated resource's excerpt. Example: PersonExcerpt
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.