Management has requested that we expose our customer database with a RESTfull api so that they can test writing a front end management tool. They have asked that we do this quickly.
CREATE TABLE `customer` (
`customer_id` bigint(20) NOT NULL AUTO_INCREMENT,
`state` varchar(255) NULL,
`address` varchar(255) NULL,
`city` varchar(255) NULL,
`join_date` date DEFAULT NULL,
`first_name` varchar(255) NULL,
`last_name` varchar(255) NULL,
`phone_number` varchar(255) NULL,
`zip` varchar(255) COLLATE NULL,
PRIMARY KEY (`customer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=335 DEFAULT
- Spring Boot
- Spring JPA
- Spring WEB
- MySql database
- add customers to the system
- retrieve all customers for a given state.
- retrieve ALL the customers in the system
- retrieve a customer by their customer id
- Fork this repository to your github account
- Clone or download the forked repository
- Create a mysql db named 'cust_db' (see instructions below)
- Import repo into your favorite ide. Note: this is a 'gradle' project so your ide must support gradle
- Implementations for Customer and CustomerRepository have been provided for you. Understand how these work.
- Provide tests and implementations for the REST api access over HTTP.
- You need to have a mysql server installed, or run one in a docker container.
Connection details can be found in Customer-REST-api/src/main/resources/application.properties
- Database name:
cust_dbMust be created before building or running the app - User / password:
custdb / custdbYou can change these if yours is different. - my sql port:
3306
- Database name:
- If you have docker installed, you can use the following command to start up a mysql server in a container.
docker run -d -e MYSQL_ROOT_PASSWORD=1234 -e MYSQL_USER=custdb -e MYSQL_PASSWORD=custdb -e MYSQL_DATABASE=cust_db -p 3306:3306 --name mysql-custdb mysql- to connect to the container db with ms client
$ mysql -h127.0.0.1 -P3306 -ucustdb -pcustdb cust_db - to stop the mysql container
$ docker stop mysql-custdb - to remove the mysql container
$ docker rm mysql-custdb
- to connect to the container db with ms client