Git Product home page Git Product logo

roman_numerals's Introduction

coverting 16 to roman numerals

roman_numerals

An API and a web based application that converts numbers to roman numerals.

Prerequisites

Usage

  • cd into project root directory

      $ cd ./server && npm install && npm start
    
  • open new terminal window.

  • cd into project root directory

      $ cd ./client && npm install && npm start
    
  • Screenshots of project are available in the screenshot folder

Testing

  • cd into project root directory

      $ cd ./server && npm test
    

Original Technical Task

Create an API and a web based application that converts numbers to roman numerals.

Technologies to use

  • Node.js 8.x

  • React

Minimum Criteria

  • Converts numbers 1 to 3999 to the equivalent value in roman numerals.

  • Converts Roman Numerals "I" to “MMMCMXCIX” to the equivalent numeric value. In reverse

  • Simple react based web interface that uses an API created by you.

  • Readme file explaining how to run the application, explain your approach and list any improvements you would make.

Ideally

  • Use ES6 syntax.

You can

  • Use any NPM modules in your application except for the conversion of numbers and roman numerals.

  • Be as creative as you like on the user interface, use any client libraries you want.

  • Don't worry too much about optimising the client code (unless you want to), you can explain how you would do this in the Readme.

More information

Approach

Below you will find a combination of assumptions made, notes, intended client approach, and intended server approach.

Assumptions

  • The endpoints doe not need to be authenticated. (If they do a bearer token will be added to the headers and a 401 status code will be returned if token is invalid)

  • The minimum criteria seems to be missing part of it's description. "In reverse ". I will ignore this until I get confirmation of what it is.

  • Data transfer will be accomplished using a Rest API. (For example not via sockets or using other technologies such as graphQL)

  • All numbers will be integers and not floats or any other data type.

  • The data will not be stored on either the client or the server after request has been made.

  • At any time only one integer or roman numeral will be passed in a request to the api.

  • No specifications on browser support have been made so I will make the assumption to support the latest 2 versions of each browser.

  • Initial value does not need to be passed back in response.

  • API will only be consumed by this client.

  • Supported devices not in specification. Going to assume a mobile first approach.

Notes

Intended approach Client

  • As the project will only have one view I will use local state and pass that down instead of using a data store such as redux. This would be overkill for something like this. I will split the logic and view into 2. A container and a view. While inheritance could be used here I will use object composition instead as react favors it.

  • Validation will be custom and created to be used individually or together using a pipeline. The pipeline will call each validator in turn with the result of the previous. If the final result is a string display this message. This allows the validators to be be used in any order while keeping the code clean, neat, and reuseable.

Intended approach Server

  • I will add middleware to log all incoming requests.

  • A model will be used for validating the incoming data.

  • The transformer functions for manipulating the data will be abstracted into a utility file to keep code clean and make it easier to test.

  • I will use enveloping to ensure all responses from the server follow the same data structure. { timestamp, data }. This allows such things a requestId and other data to be added to the object later without effecting the core data struture returned.

  • I will add middleware to prevent common security issues.

Intended API endpoits

  • GET /manipulate/roman-numeral/:value
  • GET /manipulate/number/:value

Improvements

  • Testing can be increased to 100% coverage for both client and server.
  • End to end testing can be integrated to test application from the viewpoint of the user.
  • Recent conversions could be saved in local state and shown on the left as quick references. (This is outside the scope of this project but would be a nice future feature)

roman_numerals's People

Contributors

nialloc9 avatar nialloc91 avatar

Watchers

James Cloos avatar

Forkers

nialloc91

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.