summaryrefslogtreecommitdiff
path: root/Year_3/Web/math/index.js
blob: db3f304c9aa9c58ec3dd8177ca32748e5076bc90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);