This is a repository for completing the tests given in the recruitment process. There are two tests that need to be completed, which are:
- Finding the largest number in an array
- Counting the occurrences of a string in another string
To run this project, you will need:
- Go 1.16 or higher
To use this project, follow these steps:
- Clone this repository.
- Go to the root directory of this repository.
- Run
go run main.goto start the API server. - Send a request to the API server using your preferred client (e.g.
curl).
There are two API endpoints available:
This endpoint is used to find the largest number in an array.
{
"numbers": [12, 41, 24, 2, 1, 4]
}{
"max": 41
}curl --location --request GET 'http://localhost:8080/max' \
--header 'Content-Type: application/json' \
--data-raw '{
"numbers": [12, 41, 24, 2, 1, 4]
}'This endpoint is used to count the occurrences of a string in another string.
{
"target": "makan",
"text": "selama berpuasa, Pdak dibolehkan makan dan minum. Puasa diawali dengan makan sahur dan diakhir dengan berbuka. Disunahkan untuk berbuka dengan makanan yang manis, misal dengan makan kurma."
}{
"count": 4
}curl --location --request POST 'http://localhost:8080/count' \
--header 'Content-Type: application/json' \
--data-raw '{
"target": "makan",
"text": "selama berpuasa, Pdak dibolehkan makan dan minum. Puasa diawali dengan makan sahur dan diakhir dengan berbuka. Disunahkan untuk berbuka dengan makanan yang manis, misal dengan makan kurma."
}'This project is implemented using the following architecture:
- Interface
- Clean Architecture
This project is licensed under the MIT License - see the LICENSE file for details.