Code Monkey home page Code Monkey logo

nuromancy's People

Contributors

adamcin avatar

Watchers

 avatar

nuromancy's Issues

Support min/max range conversions

Add request case defined by GET /romannumeral?min={integer}&max={integer}

{integer} must be an integer value for both the min and max parameters. Both min and max must be provided. Min must be less than max. Both must be in the supported range 1-3999.

Respond with JSON object containing a conversions array, with one element per each integer member of the input range. Each element is the same form as the response from the existing resource defined by the ?query param:

{
  "conversions": [
    { "input": "1", "output": "I" },
    { "input": "2", "output": "II" },
    { "input": "3", "output": "III" }
  ]
}

Some minor code cleanup

  • Use Promise.all() in the first test in convert.test.js
  • Use null coalesce operator (?? {}) in first line of romanNumeral handler in handlers.js

Define a GET endpoint at /romannumeral

Endpoint must accept a query QS param representing a base-10 integer value in the range of 1-3999.

Response message containing a successful conversion should be a JSON object of the form:

{
  "input": "1",
  "output": "I"
}

When an illegal request was received, the response status will be a 400, and the response message body will be a JSON object of the form:

{
  "error": "<reason>"
}

Status Codes:

  • 200: Success
  • 400: Client specified invalid parameters

Replace helloworld handler with simple html forms

Instead of leaving the original helloworld handler for the root route, which is rather useless, let's replace it with a handler that serves a string describing a pair of html forms to make it easier to navigate from / to either of the two /romannumeral query types.

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.