Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created April 15, 2026 15:34
Show Gist options
  • Select an option

  • Save tmcw/df22e295f069f1550abda13075f99876 to your computer and use it in GitHub Desktop.

Select an option

Save tmcw/df22e295f069f1550abda13075f99876 to your computer and use it in GitHub Desktop.
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