Not able to find the error

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

Repl link:

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"));"/", function (req, res) {
  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



in main index.js

then edit html to

<!DOCTYPE html>

  <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>

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



No my earlier code was running and name was same

Did you try this solution? @Prachiti-GuptaG