Skip to content

Commit 20145e7

Browse files
committed
UPDATED H2DB scripts, README.md
1 parent 27f6636 commit 20145e7

File tree

6 files changed

+173
-6
lines changed

6 files changed

+173
-6
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ This is a simple, self-conatined Spring Boot Web Application with REST end point
3838
## Details
3939

4040
- [Installation](documents/INSTALLATION.MD)
41-
- [API](documents/API.MD)
41+
- [API](documents/API.md)
4242
- [Docker](documents/DOCKER.md)
43+
- [Documentation](documents/DOCUMENTATION.md)
4344

4445
**Note** : This project has been used as an example for the following blog posts.
4546

documents/DOCUMENTATION.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Documentation
2+
3+
* Postman Collection for offline testing is available in the documents folder.
4+
* [Swagger](http://localhost:8080/swagger-ui.html) - `http://localhost:8080/swagger-ui.html`- Documentation & Testing
5+
* [OpenAPI Description](http://localhost:8080/v3/api-docs) - `http://localhost:8080/v3/api-docs`
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"info": {
3+
"_postman_id": "1b4467d0-cc0a-455b-970c-6087c5b7b61c",
4+
"name": "spring-boot-minimal-web-app",
5+
"description": "https://github.com/AnanthaRajuC/Spring-Boot-Minimal-Web-App",
6+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
7+
},
8+
"item": [
9+
{
10+
"name": "Command",
11+
"item": [
12+
{
13+
"name": "Update Person",
14+
"request": {
15+
"method": "PUT",
16+
"header": [],
17+
"body": {
18+
"mode": "raw",
19+
"raw": "{\r\n \"name\": \"John-update\",\r\n \"email\": \"example1-update@domain.com\",\r\n \"mobileNumber\": \"1234771\",\r\n \"address\": {\r\n \"city\": \"Wisokyburghh-update\",\r\n \"zipcode\": \"9077-777\"\r\n }\r\n}",
20+
"options": {
21+
"raw": {
22+
"language": "json"
23+
}
24+
}
25+
},
26+
"url": {
27+
"raw": "http://localhost:8080/api/person/1",
28+
"protocol": "http",
29+
"host": [
30+
"localhost"
31+
],
32+
"port": "8080",
33+
"path": [
34+
"api",
35+
"person",
36+
"1"
37+
]
38+
}
39+
},
40+
"response": []
41+
},
42+
{
43+
"name": "Create Person",
44+
"request": {
45+
"method": "POST",
46+
"header": [],
47+
"body": {
48+
"mode": "raw",
49+
"raw": "{\r\n \"name\": \"aws\",\r\n \"email\": \"examplt4@domain.com\",\r\n \"mobileNumber\": \"1234771\",\r\n \"address\": {\r\n \"city\": \"Wisopburgh-aws\",\r\n \"zipcode\": \"9077-777\"\r\n }\r\n}",
50+
"options": {
51+
"raw": {
52+
"language": "json"
53+
}
54+
}
55+
},
56+
"url": {
57+
"raw": "http://localhost:8080/api/person",
58+
"protocol": "http",
59+
"host": [
60+
"localhost"
61+
],
62+
"port": "8080",
63+
"path": [
64+
"api",
65+
"person"
66+
]
67+
}
68+
},
69+
"response": []
70+
},
71+
{
72+
"name": "Delete Person",
73+
"request": {
74+
"method": "DELETE",
75+
"header": [],
76+
"url": {
77+
"raw": "http://localhost:8080/api/person/3",
78+
"protocol": "http",
79+
"host": [
80+
"localhost"
81+
],
82+
"port": "8080",
83+
"path": [
84+
"api",
85+
"person",
86+
"3"
87+
]
88+
}
89+
},
90+
"response": []
91+
}
92+
]
93+
},
94+
{
95+
"name": "Query",
96+
"item": [
97+
{
98+
"name": "Get All Persons",
99+
"request": {
100+
"method": "GET",
101+
"header": [],
102+
"url": {
103+
"raw": "http://localhost:8080/api/person",
104+
"protocol": "http",
105+
"host": [
106+
"localhost"
107+
],
108+
"port": "8080",
109+
"path": [
110+
"api",
111+
"person"
112+
]
113+
}
114+
},
115+
"response": []
116+
},
117+
{
118+
"name": "Get Person by Id",
119+
"request": {
120+
"method": "GET",
121+
"header": [],
122+
"url": {
123+
"raw": "http://localhost:8080/api/person/1",
124+
"protocol": "http",
125+
"host": [
126+
"localhost"
127+
],
128+
"port": "8080",
129+
"path": [
130+
"api",
131+
"person",
132+
"1"
133+
]
134+
}
135+
},
136+
"response": []
137+
}
138+
]
139+
}
140+
]
141+
}

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html
33

44
# Comma-separated list of active profiles. Can be overridden by a command line switch.
5-
spring.profiles.active=mysql
5+
spring.profiles.active=h2db

src/main/resources/data/h2db/migrations/V0_0_1__SBMWA_structure.sql

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44
* Description: Initial database structure
55
*/
66

7+
--
8+
-- Table structure for table `address`
9+
--
10+
11+
CREATE TABLE `address` (
12+
`id` bigint(20) PRIMARY KEY AUTO_INCREMENT,
13+
`created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
14+
`last_modified_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
15+
`city` varchar(255),
16+
`zipcode` varchar(255)
17+
);
18+
719
--
820
-- Table structure for table `person`
921
--
@@ -14,5 +26,6 @@ CREATE TABLE `person` (
1426
`last_modified_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
1527
`name` VARCHAR(128),
1628
`email` VARCHAR(128),
17-
`mobile_number` VARCHAR(128)
29+
`mobile_number` VARCHAR(128),
30+
`address_id` bigint(20)
1831
);

src/main/resources/data/h2db/migrations/V0_0_2__SBMWA_data.sql

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
*/
66

77
--
8-
-- Data for table `person
8+
-- Data for table `address`
99
--
1010

11-
INSERT INTO `person` (`name`,`email`,`mobile_number`) VALUES ('John','example1@domain.com','1234567890');
12-
INSERT INTO `person` (`name`,`email`,`mobile_number`) VALUES ('Jane','example2@domain.com','1234567891');
11+
INSERT INTO `address` (`city`,`zipcode`) VALUES ('Wisokyburghh','90565-7771');
12+
INSERT INTO `address` (`city`,`zipcode`) VALUES ('Wisokyburgh','90565-777');
13+
14+
--
15+
-- Data for table `person`
16+
--
17+
18+
INSERT INTO `person` (`name`,`email`,`mobile_number`,`address_id`) VALUES ('John','example1@domain.com','1234567890',1);
19+
INSERT INTO `person` (`name`,`email`,`mobile_number`,`address_id`) VALUES ('Jane','example2@domain.com','1234567891',2);

0 commit comments

Comments
 (0)