Movies API serves backend services to manage movies, shows, artists and booking tickets. It has been built on Spring platform using spring-boot framework...
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
You need following softwares before running this application.
- Java 8 SDK
- Apache Maven 3.3 build tool
- Postgresql version 9.6
- Popular IDEs such as Intellij/Eclipse (optional)
- Postman Client for REST APIs testing (optional)
A step by step guide that helps you get a development env running
-
Go to the folder where the above project has been checked out
-
Ensure to change the password of postgres.
- Run
sudo -iu postgres
command - Run
psql
in postgres user shell - Alter default password by running
ALTER USER postgres WITH ENCRYPTED PASSWORD 'postgres@123'
; - Confirm the password by entering the command in user shell
postgres=# \password
Note: If you wish not to change the default password of postgres, then change the password in the following application configuration 1. datasource.password in movies-api/src/main/resources/application.yaml 2. database.password in movies-db/src/main/config/localhost.properties
- Run
-
Build the project using
mvn clean install -DskipTests
. First time build will consume time as it downloads all dependencies. -
Go to
movies-db
module and build the project using maven commandmvn install -Psetup,test-data
to setup the database schema called movies, tables, privileges, seed data such as groups, roles and permissions. Following are the predefined roles:- Administrator (101)
- Customer (102) - All signed up users are assigned with this role by default
Note: test-data profile is optional but this will setup an admin user with username as [email protected] and default password as movieapp@123
-
After the db setup, go to
movies-api
module and then run commandmvn spring-boot:run
. If everything is fine, then API backend application should be up and running on 8080 using the contextapi
2018-06-16 16:42:53.806 - [INFO ] - o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8080 (http) with context path '/api'
-
Access the following healthcheck url
http://localhost:8080/api/actuator/health
that should result in following output{ "status": "UP" }
-
Try accessing implemented API endpoints using swagger-ui, a plugin configured in the application. Open
http://localhost:8080/api/swagger-ui.html
in a browser and you should see all API endpoint implementation.
Best wishes!