This project is a Proof of Concept (POC) for a Ktor-based scanner application. It demonstrates the basic structure and functionalities of a web service built using Ktor, a Kotlin framework for building asynchronous servers and clients in connected systems.
- Ktor framework setup
- Basic routing and request handling
- Simple scanning functionality
- JSON response support
- Logging configuration
- AWS S3 integration for uploading and processing Pan Card images
Before you begin, ensure you have met the following requirements:
- You have installed Kotlin
- You have installed Gradle
- You have a compatible JVM installed (Java 8 or higher)
- You have an AWS account and necessary credentials
-
Clone the repository:
git clone https://github.com/adhilabu/com.example.ktor-scanner-poc.git cd com.example.ktor-scanner-poc
-
Install dependencies:
./gradlew dependencies
-
Update the
application.yaml
file with your AWS and Ktor server configurations (referapplication.yaml_backup
):ktor: access_key_id: <your_access_key_id> secret_access_key: <your_secret_access_key> region: <your_region> bucket_name: <your_s3_bucket_name> application: modules: - com.example.ApplicationKt.module deployment: port: 8080
-
Build the application:
./gradlew build
-
Start the server:
./gradlew run
-
Send a POST request to
http://localhost:8080/aws_upload
with the following form data:image
:<pan_card_image_file>
Note: Replace
<pan_card_image_file>
with the path to your Pan Card image file.The server will respond with a JSON object containing the extracted Pan Card data, such as name, father's name, date of birth, etc.
- POST
/aws_upload
- Accepts Pan Card image data and returns extracted information.
Configuration settings for the Ktor server can be found and modified in the application.yaml
file. Here you can change the server port, configure logging, and adjust other server settings as needed.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature-name
) - Make your changes
- Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature-name
) - Create a new Pull Request