Bike is a project for managing of bike. It consists of Back-end part(Spring boot REST API) and Front-end(Angular). The idea of the project is to demonstrate how Angular and Spring boot work together.
It provides folloing functionality:
- Show all bikes which are available in the DB (public)
- Purchase a bike (only for register users)
- Bike registration (only for admin users)
- User registration (only for admin users)
The entry point for a user is a website which is available under the address: http://localhost:4200/
In order to run this application you need to install two tools: Docker & Docker Compose.
Instructions how to install Docker on Ubuntu, Windows , Mac .
Dosker Compose is already included in installation packs for Windows and Mac, so only Ubuntu users needs to follow this instructions .
- Build back-end project -
mvn clean install
- Build front-end project -
ng build --prod
Now the entire application can be ran with a single command in a terminal:
$ docker-compose up -d
If you want to stop it use following command:
$ docker-compose down
-
If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key.
heroku login
-
Create new Heroku applications
-
library
- in library folder -
heroku create
- rename the application -
heroku apps:rename --app floating-sea-59474 personal-bookstore
- in library folder -
-
library-ui
- in library-ui folder -
heroku create
- rename the application -
heroku apps:rename --app floating-sea-59474 personal-bookstore-ui
- in library-ui folder -
-
-
Create a new Git repository Initialize a git repository in a new or existing directory
cd library/
orcd library-ui
git init
heroku git:remote -a {{app-name}}
-
Deploy your application Commit your code to the repository and deploy it to Heroku using Git.
git add .
git commit -am "make it better"
git push heroku master
-
Update in library-ui prod env(
environment.prod.t
) pointing to back-end heroku URL (baseUrl
)
-
Library server (Back-end) --> Run the Spring boot project in current IDE
-
Library UI (Front-end) --> Run Angular project using following command -
npm run local
This is a Spring Boot (Java) based application that connects with a database that and expose the REST endpoints that can be consumed by frontend. It supports multiple HTTP REST methods like GET, POST, PUT and DELETE
Full list of available REST endpoints could be found in Swagger UI, which could be called using link: http://localhost:9090/swagger-ui.html
This app is put in Docker container and its definition can be found in a file bike/Dockerfile.
-
Tech stack
-
Building and running as a standalone application
- Build project from using Maven -
mvn clean install
- Execute already built jar file =
java -jar target/bike-0.0.1-SNAPSHOT.jar
- Build project from using Maven -
-
Testing APIs
- Load
Bike.postman_collection.json
collection into Postman and run some of the requests
- Load
Note: The Sqlite DB automationly created and populated with predefined data.
This is a real endpoint for a user where they can review and manipulate their bikes. It consumes the REST API endpoints provided by bike.
This app is put in Docker container and its definition can be found in a file bike-ui/Dockerfile.
It can be entered using link: http://localhost:4200/
- Prerequisites
- Node JS
- Yarn package manager (Optional)
- Ng Bootstrap
- Angular CLI: 10.1.7
- Node: 12.18.4
- Docker
Note: Check if the back-end part is up and runnig
- Building and running as a standalone application
- Build of the project -
npm install
- Run the project -
npm start
- Build of the project -
- Access the SPA
- http://localhost:4200 - Main screen
- http://localhost:4200/server/api/v1/bikes - Bikes screen
- http://localhost:4200/admin - Admin screen
- Prod building and runnig
- Build it -
ng build --prod
- Run it and access it -
node server.js
- Build it -