metric-imperial-converter/routes/api.js
Rex Schrader 87ebc9c36a
Fix (Boilerplate): Add Event Parameter to test, Remove Infosec Requriements, Add Lowercase Requirement (#12)
* Fix missing event, correct example conversion

* Fix unit case

* Remove Infosec items, add lowercase requirement

* Convert to ES6, Update Packages, Fix display

* Applying @nhcarrigan's changes from site tests

* Removed unneeded mongodb ref

* Remove User Stories, Reformat README

* Apply suggestions from code review - Remove "Quality Assurance Project" Prefix

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>

* Re-add the example text, clean up formatting

* Update Favicon

* Fix repo link, remove zombie.js

* Remove unused files, add sample.env

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
Co-authored-by: Rex Schrader <rex.schader@gmail.com>
2020-11-25 09:09:04 -06:00

31 lines
712 B
JavaScript

/*
*
*
* Complete the API routing below
*
*
*/
'use strict';
const expect = require('chai').expect;
const ConvertHandler = require('../controllers/convertHandler.js');
module.exports = function (app) {
let convertHandler = new ConvertHandler();
app.route('/api/convert')
.get(function (req, res){
let input = req.query.input;
let initNum = convertHandler.getNum(input);
let initUnit = convertHandler.getUnit(input);
let returnNum = convertHandler.convert(initNum, initUnit);
let returnUnit = convertHandler.getReturnUnit(initUnit);
let toString = convertHandler.getString(initNum, initUnit, returnNum, returnUnit);
//res.json
});
};