Not able to find the error

**Question:**body-parser deprecated undefined extended: provide extended option index.js:4:20


Repl link: https://replit.com/@Prachiti-GuptaG/calculator-project#intro_to_express/index.js

const express = require("express");
const bodyParser = require("body-parser");
const App = express();
App.use(bodyParser.urlencoded({ entended: true }));

App.get("/", (req, res) => res.sendFile(__dirname + "/index.html"));

App.get("/about", (req, res) => res.send("PRACHITI GUPTA"));

App.get("/contact", (req, res) => res.send("phn no: 98xxxxxxxx"));

App.post("/", function (req, res) {
  console.log(req);
  var num1 = Number(req.body.n1);
  var num2 = Number(req.body.n2);
  result = num1 + num2;
  res.send("the result of your calculator is :" + result);
});

App.listen(8000, function () {
  console.log("server has started printing 8000 ports");
});

why is this error occurring not able to find out. please help

Hello @Prachiti-GuptaG

Why you have two index.js file?

@Prachiti-GuptaG try changing the name of one of your index.js to something else. That might be causing an error.

1 Like

Try

require("./intro_to_express/index")

in main index.js

then edit html to

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE-edge" />
  <meta name="viewport" content="width=device-width">
  <title>page title</title>
  <link href="style.css" rel="stylesheet" type="text/css" />

  <script src="main.js"></script>
</head>

<body>
  <h1>CALCULATOR</h1>
  <form action="/" method="post">
    <input type="text" name="n1" placeholder="first number" />
    <input type="text" name="n2" placeholder="second number" />
  <div>
    <button type="calculate" class="calculatebutton">calculate</button>
  </div>
  </form>

</body>

</html>

No my earlier code was running and name was same

Did you try this solution? @Prachiti-GuptaG