https://github.com/mkdika/spring5-kotlin-api
Spring 5 Kotlin REST API demo with Spring Boot 2 stacks.
https://github.com/mkdika/spring5-kotlin-api
h2-database kotlin poc rest-api spring-boot-2 spring-framework-5
Last synced: 10 months ago
JSON representation
Spring 5 Kotlin REST API demo with Spring Boot 2 stacks.
- Host: GitHub
- URL: https://github.com/mkdika/spring5-kotlin-api
- Owner: mkdika
- License: mit
- Created: 2018-09-24T13:00:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-25T05:44:11.000Z (almost 8 years ago)
- Last Synced: 2025-03-26T08:27:00.923Z (over 1 year ago)
- Topics: h2-database, kotlin, poc, rest-api, spring-boot-2, spring-framework-5
- Language: Kotlin
- Homepage:
- Size: 75.2 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spring Kotlin REST API
[](/LICENSE)
[](https://travis-ci.org/mkdika/spring5-kotlin-api)
[](https://codecov.io/gh/mkdika/spring5-kotlin-api)
[](https://codebeat.co/projects/github-com-mkdika-spring5-kotlin-api-master)
Spring 5 Kotlin REST API demo with Spring Boot 2 stacks. This project is consist of CRUD Web endpoint.

## Tech Stack
- Java8 (JDK 8 update 171)
- [Kotlin 1.2.70](https://kotlinlang.org/)
- [Spring Boot 2.0.5](http://spring.io/projects/spring-boot)
- [Gradle 4.8.1](https://gradle.org/)
- [H2DB](http://www.h2database.com/html/main.html)
- [Undertow Web Server](http://undertow.io/)
- [Jacoco](https://www.eclemma.org/jacoco/)
## Build, Test & Run the Application
### Build
```console
gradlew clean build
```
Find the built result at `/build/libs/spring-kotlin-api-1.0.0.jar`
### Automatic Test
```console
# run all test
gradlew test
# run coverage test report
gradlew jacocoTestReport
```
Find the test result report at `/build/reports/test/` for __test__ result, and `/build/reports/jacoco`
for __Jacoco__ coverage test result report.
### Run the Application
```console
gradlew bootRun
```
Access from local url: `http://localhost:8080`
### Test REST API Locally
Test the REST API locally with [Curl](https://curl.haxx.se/download.html) or alternatively
you can use [Insomnia](https://insomnia.rest/) Web API Test, feel free to download my
Insomnia Workspace at [Here](https://goo.gl/Ck8L2J) and import into yours.
### REST API Endpoints
| HTTP Method | Path | Description |
| ----------- | ------------------ | ------------------------------------ |
| GET | /api/customer | Get all existing customer data. |
| GET | /api/customer/{id} | Get existing customer data by Id. |
| POST | /api/customer | Insert new customer data. |
| PUT | /api/customer/{id} | update existing customer data by Id. |
| DELETE | /api/customer/{id} | Delete existing customer data by Id. |
## Reference
- [Spring Boot and Kotlin](https://www.baeldung.com/spring-boot-kotlin)
- [Creating a RESTful Web Service with Spring Boot](https://kotlinlang.org/docs/tutorials/spring-boot-restful.html)
- [Building Restful APIs with Kotlin, Spring Boot, Mysql, JPA and Hibernate](https://www.callicoder.com/kotlin-spring-boot-mysql-jpa-hibernate-rest-api-tutorial/)
- [Creating and Testing a Kotlin RESTful Web Services using Spring Boot](https://medium.com/@crsandeep/creating-and-testing-a-kotlin-restful-web-services-using-spring-boot-1a11aeda279e)
- [More readable tests with Kotlin](https://www.tengio.com/blog/more-readable-tests-with-kotlin/)
- [Test coverage in Kotlin with Jacoco](https://kevcodez.de/index.php/2018/08/test-coverage-in-kotlin-with-jacoco/)
- [Codecov Kotlin Example](https://github.com/codecov/example-kotlin)
## Copyright and License
Copyright 2018 Maikel Chandika (mkdika@gmail.com). Code released under the
MIT License. See [LICENSE](/LICENSE) file.