Skip to content

CodeNinjai/k8s-restservice

Repository files navigation

k8s-restservice

k8s-restservice is a simple Kotlin-based Spring Boot application that provides a REST API endpoint returning "Hello World" as a response. This project is designed to demonstrate basic Spring Boot functionality and Docker integration.

Table of Contents

Getting Started

These instructions will help you set up and run the HelloWorldService on your local machine for development and testing purposes.

Prerequisites

  • JDK 17 or later
  • Gradle (or use the Gradle wrapper provided)
  • Docker (if running with Docker)

Building and Running Locally

  1. Clone the repository:

    git clone https://github.com/yourusername/helloworldservice.git
    cd helloworldservice
  2. Build the project:

    ./gradlew build
  3. Run the application:

    ./gradlew bootRun
  4. Access the application:

    Visit http://localhost:8080/api/hello in your browser or use a tool like curl:

    curl http://localhost:8080/api/hello

    You should see the response: Hello World

Running with Docker

  1. Build the Docker image:

    docker build -t helloworldservice:latest .
  2. Run the Docker container:

    docker run -p 8080:8080 helloworldservice:latest
  3. Access the application:

    Visit http://localhost:8080/api/hello in your browser or use a tool like curl:

    curl http://localhost:8080/api/hello

API Endpoints

The HelloWorldService provides the following endpoint:

  • GET /api/hello - Returns "Hello World".

Configuration

The application can be configured via the application.properties or application.yml file located in the src/main/resources directory.

Example application.properties:

server.port=8080
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin feature/your-feature-name).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published