Skip to content

restful api implementation

windula_k edited this page Nov 3, 2023 · 5 revisions

RESTful API implementation

About the Application

This is a simple web application that exposes a REST API. This application uses Maven as the build tool and the current LTS version of Kotlin 1.7. I hope to add more functionality to this application in the future but for now this project uses the following dependencies:

  • Spring Web
  • Spring JPA/Hibernate
  • Mysql Database
  • Junit

Running the application

You can run this application from your IDE or by running the following command:

./mvnw spring-boot:run

Testing the application

This application uses Junit 5 unit tests and Tescontainers.

Building for Production

If you want to build an artifact that can be used in production you have 2 options. This application uses JAR as the packaging type.

./mvnw clean package

Functionalities

  • KPI Data Retrieval: Users can retrieve key performance indicators for weather data within specified time frames.
  • Custom Time Range Queries: Supports querying data based on custom date ranges provided by the user.
  • Summary and Precipitation Type Analysis: Allows analysis based on weather summary and precipitation types.
  • Browsable API UI: Integrated Swagger UI for easy navigation and testing of the API endpoints.

Known Issues

  • CORS Policy Restrictions: Some users may encounter CORS policy issues when accessing the API from different origins.

  • Error Handling: Exception handling needs to be more robust to cover a wider range of potential failures and provide more informative error messages.

Potential Future Plans

Given more time and resources, the following enhancements are planned:

  • SSM Database Credential Fetching: Implement AWS Systems Manager (SSM) to securely fetch database credentials, avoiding hard-coded sensitive information.
  • Arrow Integration: Utilize the Arrow library to bring more idiomatic functional programming constructs to the Kotlin codebase, enhancing readability and maintainability.
  • Inline Functions: Leverage Kotlin's inline functions for higher-order functions to reduce overhead and improve performance.
  • PIA Security: Implement Privacy Impact Assessment (PIA) compliant security measures to ensure user data is handled with the highest standards of privacy and security.
  • API Rate Limiting: Introduce rate limiting to prevent abuse and ensure fair usage of the API resources.

Clone this wiki locally