Git Product home page Git Product logo

word-validation's Introduction

word-validation

English Word Validation API

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.

Table of Contents

Setup

Prerequisites

  • Go (v1.17 or later)

Build and Run Locally

  1. Clone the repository:

    git clone https://github.com/BishowShrestha50/word-validation.git
  2. Go to the project directory:

    cd word-validation
  3. Run the project

    go run main.go 

Docker Setup

Build Docker Image

  1. 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
    
  2. Push docker image to your registry:

    docker push  <USERNAME>/<REPO-NAME>:<TAG>
    

Run container

docker run --rm --env-file=<ENV-PATH> -p 8080:8080 <USERNAME>/<REPO-NAME>:<TAG>

Kubernetes Setup

Deploy to Kubernetes Cluster

  1. Create deployment

    kubectl apply -f kubernetes/deployment.yaml
    
  2. Create service of the deployment

    kubectl apply -f kubernetes/service.yaml
    
  3. 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 
    
  4. Create ingress route for external access

    kubectl apply -f kubernetes/ingress.yaml
    

Access the service

kubectl port-forward -n dev svc/<service-name>  8080:80

API usage

Endpoint

  1. Endpoint URL
    GET <BASE_URL>/v1/validate
    
  2. Parameters
    word: string value of the word to be searched 
    

Example

Valid Response

Request: GET /v1/validate?word=boat
Response: { "valid": true }

Invalid Response

Request: GET /v1/validate?word=bbb
Response: { "valid": false }

word-validation's People

Contributors

bishowshrestha avatar bishowshrestha50 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.