Git Product home page Git Product logo

lifeway-code-challenge's Introduction

Lifeway Code Challenge - Word Count Application

Build and Run Requirements

Java JDK 17 or higher is required because the application uses the new Java record type.

Repository

Clone repository: git clone https://github.com/aero-don/lifeway-code-challenge.git

Branches

There are two branches in the repository to demonstrate two different implementations.

Event Driven Branch

The event driven branch contains an event driven implementation using a layered design approach. The requests are saved in a local cache that represents an event source. This branch also demonstrates the use of a reactive HTTP endpoint, allowing the client to decide if the HTTP response should be delivered synchronously or asynchronously.

Checkout event driven branch git checkout event-driven

Master Branch

The master branch contains a state-based implementation using a layered design approach.

Checkout master branch: git checkout master

Assumptions

  1. The REST endpoint is not required to be secured.
  2. The request ids are not required to be persisted across application restarts.
  3. A request id may not be null, an empty string or a string with only blank spaces.
  4. A message may not be null or an empty string, but may be a string with only black spaces. In the case of a string with only blank spaces the word count is zero and the id will be ignored for any future requests with the same id.
  5. The words in the message are separated by one or more blank spaces, and any combination of characters separated by a blank space is considered to be a word.
    1. If other characters (e.g., comma, period, question mark, exclamation mark) can separate two words without a blank space, then the regular expression used to tokenize the string would need to be updated.
    2. If any combination of characters separated by a blank space is not considered a word, then additional filtering would be required to not count those combinations as words.

Clean, Build, Run, Test and Document

The project uses the Gradle build tool and the Micronaut framework.

All commands are executed from the root directory of the project.

Clean

  • Linux/Mac: ./gradlew clean
  • Windows: gradlew.bat clean

Build

The first build will take a little time to download all the dependencies.

The build target depends on the test target; therefore, all tests are executed as part of the build process.

  • Linux/Mac: ./gradlew build
  • Windows: gradlew.bat build

Test Results: build/reports/tests/test/index.html

Run

The application is configured to serve up the REST endpoint on port 8787.

  • Linux/Mac: ./gradlew run
  • Windows: gradlew.bat run

Exit application: ctrl-c

The application REST endpoint accepts an HTTP POST request at the following URL: http://localhost:8787/words/

The application includes OpenAPI support and the Swagger UI can be accessed at following URL: http://localhost:8787/swagger-ui/

Test

For tests, the application is configured to serve up the REST endpoint on port 8887.

  • Linux/Mac: ./gradlew test
  • Windows: gradlew.bat test

Execute clean before executing test to re-run tests when there are no code changes.

See build for location of test results.

Documentation

All code includes javadoc documentation.

  • Linux/Mac: ./gradlew javadoc
  • Windows: gradlew.bat javadoc

javadoc: build/docs/javadoc/index.html

lifeway-code-challenge's People

Contributors

aero-don 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.