Skip to content

ranabhat/db-programming-assignment

Repository files navigation

Dream Broker Programming Assignment

JavaScript Style Guide Build Status

Task

This task is to implement an API endpoint, deploying it and providing an URL for testing. You can follow the quick start guide to start building the API. You should implement an endpoint to analyze text. Curl command to call your API might look like this:

curl --header "Content-Type: application/json" \
            --request POST \
            --data '{"text":"hello 2 times  "}' \
            https://mysuperawesomeapi.com/analyze

And the response should be:

{
            "textLength":{"withSpaces":15,"withoutSpaces":11},
            "wordCount":3,
            "characterCount":[{"e":2},{"h":1},{"i":1},{"l":2},{"m":1},{"o":1},{"s":1},{"t":1}]
        }
            

Technology Used

  • Nodejs Open-source and cross-platform JavaScript runtime environment
  • Express Fast, unopinionated, minimalist web framework for Node.js
  • Javascript prototype-based, multi-paradigm, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles
  • Jest a delightful JavaScript Testing Framework with a focus on simplicity.
  • Travis-CI continuous integration platform that supports our development process by automatically building and testing code changes, providing immediate feedback on the success of the change
  • Standard JS JavaScript style guide, linter, and formatter which automatically format code, catch style issues & programmer errors early and need no configuration

Contents

  • If you don't already have it, install Node
  • If you don't already have it, install git
  1. Open up your favorite kind of console
  2. Navigate to the folder in which you want to store the source code
  3. Run git clone https://github.com/ranabhat/db-programming-assignment.git
  1. Open up the source code in your code editor (I recommend Visual Studio Code if you don't have a preference)
  2. Run npm install in the console to install dependencies (it'll take a while on the first run, so go on and read ahead while you wait)
  3. Start modifying the code to build your own application
  4. Run npm run start in console
  5. Open your browser in the address printed to the console
  6. From Terminal curl --header "Content-Type: application/json" \ --request POST \ --data '{"text":"hello 2 times "}' \ https://localhost:8080/analyze
  1. Go to the directory that has Dockerfile and run docker build -t <nameyouwanttogive> .
  2. Run the image docker run -p 49160:8080 -d <nameyouwanttogive>
  3. Run curl -i localhost:49160/analyze
  4. Run curl -i --header "Content-Type: application/json" \ --request POST \ --data '{"text":"hello 2 times "}' \ localhost:49160/analyze
  1. Run curl -i --header "Content-Type: application/json" \ --request POST \ --data '{"text":"hello 2 times "}' \ https://db-challenge-db.herokuapp.com/analyze

All of the code is licensed under the MIT license

About

Code Challenge to implement an API endpoint and deploying it.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published