Skip to content

Commit 7b276cc

Browse files
committed
🎨 Creates the structure
1 parent a74bae2 commit 7b276cc

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/controllers/Factorial/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Request, Response } from 'express';
2+
3+
class FactorialController {
4+
compute(request: Request, response: Response) {
5+
console.log(request.query);
6+
return response.send("ok, it's working!");
7+
}
8+
}
9+
10+
export default FactorialController;

src/routes.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Router, Response } from 'express';
1+
import { Router } from 'express';
2+
import FactorialController from './controllers/Factorial';
23

34
const route = Router();
45

5-
route.get('/hello', (_, response: Response) => {
6-
return response.json({ hello: "world" });
7-
});
6+
const factorialController = new FactorialController();
7+
8+
route.get('/factorial', factorialController.compute);
89

910
export default route;

0 commit comments

Comments
 (0)