summaryrefslogtreecommitdiff
path: root/Year_3/Web/math/index.js
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-07-28 20:46:51 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-07-28 20:46:51 +0200
commit8a54cce9efe8bad8a0e3d80adb4b7d771dcc5b6e (patch)
tree6ed804b82b355a3f54f9d4de1ba31db33b3523dd /Year_3/Web/math/index.js
parentf3007671f230087d017036992844a04fdc812c22 (diff)
add exercise
Diffstat (limited to 'Year_3/Web/math/index.js')
-rw-r--r--Year_3/Web/math/index.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/Year_3/Web/math/index.js b/Year_3/Web/math/index.js
new file mode 100644
index 0000000..db3f304
--- /dev/null
+++ b/Year_3/Web/math/index.js
@@ -0,0 +1,24 @@
+const express = require("express");
+
+const app = express();
+
+app.use(express.urlencoded({ extended: false }));
+app.use(express.json());
+
+app.get("/", (req, res) => {
+ res.json({ result: 0 });
+});
+
+app.post("/calculate", (req, res) => {
+ const { value1, value2 } = req.body;
+
+ res
+ .status(200)
+ .json({
+ param1: Number(value1),
+ param2: Number(value2),
+ result: Number(value1) + Number(value2),
+ });
+});
+
+app.listen(3000);