Calculating the Fibonacci sequence with Express
The Fibonacci numbers are the integer sequence: 0 1 1 2 3 5 8 13 21 34 ...
Each entry in the list is the sum of the previous two entries in the list, and the sequence was invented in 1202 by Leonardo of Pisa who was also known as Fibonacci. One method to calculate entries in the Fibonacci sequence is the recursive algorithm we showed earlier. We're going to create an Express application that uses the Fibonacci implementation and then explore several methods to mitigate performance problems in computationally intensive algorithms.
Let's start with the blank application we created in the previous step. We had you name that application fibonacci
for a reason. We were thinking ahead.
In app.js
make the following changes:
Change
require('./routes/user')
tofibonacci = require('./routes/fibonacci')
Delete the route
app.get('/users'..
and in its placeapp.get('/fibonacci', fibonacci.index);
For the Fibonacci application we don't need to support users...