/api-rest

Primary LanguageTypeScript

Api-rest

Simple Spring Cloud based Microservice system for training purposes.

Technologies included:

  • Angular 14.* frontend application
  • Cypress e2e functional test
  • Spring Cloud Gateway
  • Spring Cloud Discovery Server
  • Spring Boot 2.7.1 backend REST API
  • Prometheus and Grafana monitoring
  • Docker & docker-compose container technology
  • Jmeter test plan

Diagram

architecture

Dependencies

  • Java openjdk version "17"
  • Node v16.16.3
    • @angular/cli
  • Docker & docker-compose

Run the project

Execute this commands to run the application:

$ cd ./api-rest
$ docker-compose up

Once started browse the app following this link:

URL: http://localhost

Or execute e2e tests by running:

$ cd ./frontend
$ npx cypress run

Components

Frontend

Angular Application with a very simple interface to make CRUD requests.

Gateway

Spring Cloud Gateway as gatekeeper

BASE-URL: http://localhost:8080

Discovery-server

Spring Cloud Discovery Server

Dashboard: http://localhost:8761

Api

Spring-boot WEB CRUD Application.

BASE-URL: http://localhost:8090/api/v1/hotels

OPERATION METHOD URI
CREATE GET http://localhost:8090/api/v1/hotels
READ GET http://localhost:8090/api/v1/hotels/{id}
UPDATE PUT http://localhost:8090/api/v1/hotels
DELETE DELETE http://localhost:8090/api/v1/hotels/{id}

API Documentation:

http://localhost:8090/swagger-ui.html

Prometheus

The Api project is configured to serve all the metrics at http://localhost:8090/actuator/prometheus

Access to Prometheus Dashboard: http://localhost:9090

Prometheus configuration is located at:

$ ./prometheus

Grafana

You can also use Grafana to visualize all the above commented prometheus metrics.

Access to Grafana Dashboard: http://localhost:3000

Import the dashboard created at:

$ ./grafana