Web app that takes a text file and finds the top K most frequent words.
- Java 17
- Spring Boot 3
cd top-k-words
./gradlew clean build
cd top-k-words
./gradlew run
Postman could be used for friendly UI, but the instuctions are provided for CURL just to make testing simple ๐
Try send GET reqiest to default "hello" endpoint /
to verify that the app is running at localhost:8080
:
curl -X GET http://localhost:8080/
The only credentials allowed are
- email: [email protected]
- password: test
curl -X POST http://localhost:8080/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"test"}'
The responce should be in the following format:
{"token":"JWT_TOKEN"}
curl -X POST http://localhost:8080/api/topk/analyze \
-F "[email protected]" -F "k=10" \
-H "Authorization: Bearer JWT_TOKEN"
Feel free to experiment with the file content and K parameter.
3 sec delay was added to the file analysis to demonstrate caching impact on the app performance! Call /api/topk/analyze
endpoint second time with the same parameters (same K value and same file content) to test caching.