Giter Site home page Giter Site logo

fcc-metric-imperial-converter's Introduction

fCC Information Security and Quality Assurance Projects: Metric-Imperial Converter

  • Build a full stack JavaScript app that is functionally similar to this: https://hard-twilight.glitch.me/.
  • Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.
  • Start this project on Glitch using this link or clone this repository on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!

  1. SET NODE_ENV to test without quotes
  2. Most logic will need done in controllers/convertHandler.js but do complete routes/api.js
  3. You will add any security features to server.js
  4. You will create all of the functional/unit tests in tests/2_functional-tests.js and tests/1_unit-tests.js

USER STORIES:

  • 1. I will help prevent the client from trying to guess(sniff) the MIME type.
  • 2. I will prevent cross-site scripting (XSS) attacks.
  • 3. I can GET /api/convert with a single parameter containing an accepted number and unit and have it converted.
  • 4. Hint: Split the input by looking for the index of the first character.
  • 5. I can convert 'gal' to 'L' and vice versa. (1 gal to 3.78541 L)
  • 6. I can convert 'lbs' to 'kg' and vice versa. (1 lbs to 0.453592 kg)
  • 7. I can convert 'mi' to 'km' and vice versa. (1 mi to 1.60934 km)
  • 8. If my unit of measurement is invalid, returned will be 'invalid unit'.
  • 9. If my number is invalid, returned with will 'invalid number'.
  • 10. If both are invalid, return will be 'invalid number and unit'.
  • 11. I can use fractions, decimals or both in my parameter(ie. 5, 1/2, 2.5/6), but if nothing is provided it will default to 1.
  • 12. My return will consist of the initNum, initUnit, returnNum, returnUnit, and string spelling out units in format {initNum} {initial_Units} converts to {returnNum} {return_Units} with the result rounded to 5 decimals.
  • 13. All 16 unit tests are complete and passing.
  • 14. All 5 functional tests are complete and passing.

Example Usage:

/api/convert?input=4gal
/api/convert?input=1/2km
/api/convert?input=5.4/3lbs
/api/convert?input=kg

Example return:

{initNum: 3.1, initUnit: 'mi', returnNum: 5.0000008, returnUnit: 'km', string: '3.1 miles converts to 5.00002 kilometers'}

fcc-metric-imperial-converter's People

Contributors

brimarq 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.