Calculating the Fibonacci sequence with an Express application
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 will 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:
Delete the line
require('./routes/users')
and replace it withvar fibonacci = require('./routes/fibonacci');
Delete the line:
app.use('/users', users)
and replace it withapp.use('/fibonacci', fibonacci);
For the Fibonacci...