Created
April 15, 2026 15:34
-
-
Save tmcw/df22e295f069f1550abda13075f99876 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import express from "express"; | |
| const app = express(); | |
| app.use(express.json()); | |
| function factorial(n) { | |
| if (n === 1) return 1; | |
| return n * factorial(n - 1); | |
| } | |
| app.get("/:number", async (req, res) => { | |
| res.status(200).json(factorial(req.params.number)); | |
| }); | |
| console.log("serving on http://localhost:3008"); | |
| app.listen(3008); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment