metric-imperial-converter/routes/api.js

31 lines
712 B
JavaScript
Raw Normal View History

2017-02-18 20:14:10 +01:00
/*
*
*
* Complete the API routing below
*
*
*/
'use strict';
const expect = require('chai').expect;
const ConvertHandler = require('../controllers/convertHandler.js');
2017-02-18 20:14:10 +01:00
module.exports = function (app) {
let convertHandler = new ConvertHandler();
2017-02-18 20:14:10 +01:00
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);
2017-02-18 20:14:10 +01:00
//res.json
});
};