Skip to content

Commit

Permalink
making changes based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mrahmed2026 authored and mrahmed2026 committed Aug 31, 2024
1 parent a2bb664 commit 01ceda3
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/fibRoute.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Request, Response } from "express";
import { Request, Response } from 'express';
import fibonacci from './fib';

// Endpoint for querying the fibonacci numbers
export default (req: Request, res: Response) => {
const { num } = req.params as { num: string }; // Explicitly typing `num` as a string
const { num } = req.params as { num: string };

const fibN = fibonacci(parseInt(num));
let result = `fibonacci(${num}) is ${fibN}`;
const parsedNum: number = parseInt(num, 10);
const fibN: number = fibonacci(parsedNum);
let result = fibonacci(${num}) is ${fibN};

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 10 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

if (fibN < 0) {
result = `fibonacci(${num}) is undefined`;
}
if (fibN < 0) {
result = fibonacci(${num}) is undefined;

Check failure on line 13 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 13 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

';' expected.

Check failure on line 13 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

',' expected.

Check failure on line 13 in src/fibRoute.ts

View workflow job for this annotation

GitHub Actions / test

';' expected.
}

res.send(result);
};
res.send(result);
};

0 comments on commit 01ceda3

Please sign in to comment.