Giter Site home page Giter Site logo

hateoas-navigator-tutorial's Introduction

HateoasNavigatorTutorial

This project was generated with Angular CLI version 6.0.7.

Requirements

  1. yarn version >= 1.7.0
  2. Java JDK >= 1.8

Tutorial

Setup UI

  1. yarn add global @angular/cli
  2. ng new hateoas-navigator-tutorial --routing=true
  3. cd hateoas-navigator-tutorial
  4. ng add @angular/material
  5. ng add resource-components

What does ng add resource-components do?

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())
  1. Due to an angular issue, replace GenericRoutes.get() by the array it returns
  2. 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>

Setup backend

  1. Go to https://start.spring.io
  2. Choose the dependencies "Rest Repositories", "JPA" and "H2" ("Devtools" and "Lombok" if you wish)
  3. Generate Project, unzip the downloaded zip
  4. 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>

Add some entities to the backend

  1. Create an entity, example: Person. Note: Currently HATEOAS Navigator requires a @Version in every root entity.
  2. Create a repository, example: PersonRepository.
  3. Then start the backend: ./mvnw spring-boot:run

Integrate hateoas-navigator

  1. Start the UI ng serve

Now you can navigate to the previously created resource, create, list, edit and delete items.

Add excerpts

If you have an association from one resource to another, define an excerpt projection to see the associated resource's excerpt. Example: PersonExcerpt

Development server

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.

Code scaffolding

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.

Build

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.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

hateoas-navigator-tutorial's People

Contributors

huberchrigu avatar

Watchers

James Cloos avatar  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.