This project implements a simple REST API for validating English words. It provides an endpoint that takes a word as a parameter and responds with whether the word is valid based on a pre-defined list of over 350,000 English words.
- Go (v1.17 or later)
-
Clone the repository:
git clone https://github.com/BishowShrestha50/word-validation.git
-
Go to the project directory:
cd word-validation
-
Run the project
go run main.go
-
Build docker image with your registry username and repo name
docker build -t <USERNAME>/<REPO-NAME>:<TAG> .
Use sample docker image:
bishowshrestha50/word-validation:latest
-
Push docker image to your registry:
docker push <USERNAME>/<REPO-NAME>:<TAG>
docker run --rm --env-file=<ENV-PATH> -p 8080:8080 <USERNAME>/<REPO-NAME>:<TAG>
-
Create deployment
kubectl apply -f kubernetes/deployment.yaml
-
Create service of the deployment
kubectl apply -f kubernetes/service.yaml
-
Deploy ingress controller
For AWS infrastructure (LB), leveraging aws-lb-controller
helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=my-cluster --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller
-
Create ingress route for external access
kubectl apply -f kubernetes/ingress.yaml
kubectl port-forward -n dev svc/<service-name> 8080:80
- Endpoint URL
GET <BASE_URL>/v1/validate
- Parameters
word: string value of the word to be searched
Valid Response
Request: GET /v1/validate?word=boat
Response: { "valid": true }
Invalid Response
Request: GET /v1/validate?word=bbb
Response: { "valid": false }