Spring boot restfull API(the backend) and MySql database and frontend design and implement by Angular(10) and Bootstrap4
- No need authentication with the Angular client and rest api.
- Simple Employee mamangement scenarios that controlled by super admins
- No home page, so redirected to employee registration view
- Ignored H2 embbeded database on spring boot and connect with MySQL(Production ready)
- No validation on client side, Validating on serverside
- Fixed departments and fixed rolls
- If user roll changes "Employee" to "Supervisor", the assignee will be removed on this employee
Required Environment Configurations on Windows
- MySQL running on Apache server (Xampp) - Tutorial for setup xampp on windows
- Java - Tutorial for setup Java on windows
- NodeJs - Tutorial for setup NodeJs on windows
- Angular - Tutorial for setup Angular
Great!. Now we have setup the environment that we want to buil and run our applications. Now clone or download this repository. If you download unzip the zip file and please follow below guild lines.
- Using xampp controll panel run both Apache and MySQL services.
- Open phpmyadmin on localhost and Create a database and named it as
restdb
.
- After unzipped the zip file that downloaded, go to api folder. Inside of this folder contains source code of the spring boot rest api app.
- go to
target
folder. In my case the path isC:\Users\EJ\Downloads\spring-rest-api-master\api\target
. Ok, now we are on folder that contains production build jar file of our rest api. We can deploy to any server and run our rest api using only this jar file. - Now we want to run this jar file. Todo that we can use
command line interface
(In windows we call itCommand Prompt(cmd)
). Just open the cmd on this folder and enter java -jar ou-rest-0.0.1.jar and hit enter(or return button). Now you can see our spring boot app is running on slef hosted tomcat server. That's the beauty of spring boot. - When running if there any error such like
Unknown database 'restdb'
, means you didn't create a database on your localhost. Please follow below steps again. - And if your port 8080 is busy or used by another app, It will throw an exeptions, Please stop all the services running on port 8080 before run Jar file
- Finally without any exception you can see running tomcat server on port 8080.
- Now our rest api is running on localhost:8080
- After unzipped the zip file that downloaded, go to views folder. Inside of this folder contains source code of the Angular frontend.
- In my case the path is
C:\Users\EJ\Downloads\spring-rest-api-master\views
. And open cmd on this folder and enternpm install
. Then all npm module dependecies are will download. - Now we can run Angular app by typing
ng serve -o
in cmd just after the npm modules are installed. - Now you can see app is running on
localhost:4200
. If your port 4200 is busy, please stop all the services running on port 4200.
Great, Now you hosted the rest api and the angular app.