You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
712 B
JavaScript
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
|
|
});
|
|
|
|
};
|