Skip to content

SaipranavK/BST_Insertion_API-using-Elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binary Search Tree using Elixir

Build Status

The following challenges are addressed in the build:

  1. Setting up a repository on Github that automatically runs tests for every time you push e.g. with Travis-CI
  2. Implementing the binary search tree insert operation in the language of your choice (at Motorola we use the language Elixir a lot)
  3. Optional challenge: implement a REST API for the insert operation. If you choose Elixir as your programming language, use Plug.
  4. Optional challenge: dockerize your application, deploy on Kubernetes and set-up ingress. You can use a free service such as e.g. kubesail.com.

This build is a REST API implementation of Binary Search Tree (BST) insertion opertation using Elixir and Plug dockerized and deployed with kubernetes GitHub checks are powered by Travis-CI and the results of the every commit on the repository can be seen at https://travis-ci.com/github/SaipranavK/motorola-student-worker-challenge

Usage

The docker image of this build can be pulled using the command:

docker pull saipranavk/binary-search-tree 

available on DockerHub at https://hub.docker.com/r/saipranavk/binary-search-tree or

To run the docker image use command:

docker run saipranavk/binary-search-tree 

or you can directly access the API at https://binary-search-tree.saipranavk.usw1.kubesail.org/
Following are the Endpoints available in the API

  1. GET: "/" - Generic test route to check if the server is running
    Response: "Binary Search Tree REST API" with status code 200

  2. POST: "/insert" - Route to create tree/add new node
    Payload: { "tree": tree, "n": n } where, n is the value to be added. To create a new tree pass "tree": null/nil.
    Response: tree with status code 200

Sample POSTMAN request are attached below for reference:

To create a new tree with n as root element

To add a new element to an exisiting tree

n must be an interger. Invalid key value pair of n will return with response

Invalid payload will return


Author : Saipranav Koyyada (ksaipranav@gmail.com)

https://www.linkedin.com/in/saipranavkoyyada/

Please feel free to contact for any queries or feedback.

About

REST API implementation of Binary Search Tree insert operation using Elixir and Plug

Topics

Resources

Stars

Watchers

Forks