Experimental spring api project.
It includes;
- project structe
- exception handling
- example restcontroller (create, paginated list apis)
- spring security based authentication / authorization
- API http curl requests
- Example data scripts
# build & push to image local or remote docker registry
use the release.sh script as below. we use semantic versioning.
PATCH version when you make backwards compatible bug fixes,
MINOR version when you add functionality in a backwards compatible manner, and
MAJOR version when you make incompatible API changes.
ref : https://semver.org
./release.sh patch #version 1.0.0 -> to be -> 1.0.1
./release.sh minor #version 1.0.0 -> to be -> 1.1.0
./release.sh major #version 1.0.0 -> to be -> 2.0.0
Java18
Spring Boot 2.6.7 (Spring 5.3.19)
Undertow 2.2.17.Final
Gradle 7.4.1
Log4j2
Lombok
H2Db (in memory)
Liquibase
Intellij IDEA (recommended IDE)
Docker
- build.sh
- release.sh
request
curl --request POST
--url 'http://localhost:8080/api/rest/v10/employees'
--header 'Authorization: Basic dHVyZ2F5OnRjMTIzNA=='
--header 'Content-Type: application/json'
--data '{
"email":"[email protected]",
"fullname": "Turgay Can",
"title": "Software Engineer"
}'
response
{
"status": {
"code": "0",
"description": "No Error"
},
"txKey": "d76985aa66fb47398084d2d40d2955ba",
"data": {
"id": 11,
"fullname": "Turgay Can",
"title": "Software Engineer",
"createDate": "2022-05-12T16:08:00.523+00:00"
}
}
request
curl --request GET
--url 'http://localhost:8080/api/rest/v10/employees?page=0&max=20'
--header 'Authorization: Basic dHVyZ2F5OnRjMTIzNA=='
--header 'Content-Type: application/json'
--data '{
"fullname":"turgay"
}'
response
{
"content": [
{
"id": 11,
"email": "[email protected]",
"fullname": "Turgay Can",
"title": "Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 1,
"email": "[email protected]",
"fullname": "Turgay Can",
"title": "Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
}
],
"totalElements": 2,
"pageSize": 20,
"pageNumber": 0,
"status": {
"code": "0",
"description": "No Error"
},
"txKey": "d76985aa66fb47398084d2d40d2955ba"
}
request
curl --request GET
--url 'http://localhost:8080/api/rest/v10/employees?page=0&max=20'
--header 'Authorization: Basic dHVyZ2F5OnRjMTIzNA=='
--header 'Content-Type: application/json'
--data '{
}'
response
{
"content": [
{
"id": 7,
"email": "[email protected]",
"fullname": "Burak Kandil",
"title": "Senior Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 6,
"email": "[email protected]",
"fullname": "Melek Uzun",
"title": "Senior Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 8,
"email": "[email protected]",
"fullname": "Kenan Kartal",
"title": "Ambitious Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 9,
"email": "[email protected]",
"fullname": "Merve Ecevit",
"title": "Ambitious Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 10,
"email": "[email protected]",
"fullname": "Birgül Ayaz",
"title": "Principal Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 1,
"email": "[email protected]",
"fullname": "Turgay Can",
"title": "Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 2,
"email": "[email protected]",
"fullname": "Serdar Kuzucu",
"title": "Software Architect",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 5,
"email": "[email protected]",
"fullname": "Atakan Ülker",
"title": "Senior Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 4,
"email": "[email protected]",
"fullname": "Ali Ayberk Ünsalan",
"title": "Senior Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
},
{
"id": 3,
"email": "[email protected]",
"fullname": "Fatih Bozik",
"title": "Senior Software Engineer",
"createDate": "2022-05-11T21:00:00.000+00:00"
}
],
"totalElements": 10,
"pageSize": 20,
"pageNumber": 0,
"status": {
"code": "0",
"description": "No Error"
},
"txKey": "d76985aa66fb47398084d2d40d2955ba"
}