Now that we've implemented a REST-based server, we can return to the Fibonacci application, applying what we've learned to improve it. We will lift some of the code from fiboclient.js and transplant it into the application to do this. Create a new file, routes/fibonacci-rest.js, with the following code:
const express = require('express');const router = express.Router();const http = require('http');const math = require('../math');router.get('/', function(req, res, next) { if (req.query.fibonum) { var httpreq = http.request({ host: "localhost", port: process.env.SERVERPORT, path: "/fibonacci/"+Math.floor(req.query.fibonum), method: 'GET' }); httpreq.on('response', response => { response.on('data', ...