While I try to change the string value to number I am facing a error.
const express=require('express');
const bodyParser=require('body-parser');
const app=express();
app.use(bodyParser.urlencoded({extended:true}));
app.get("/" ,function(req,res){
res.sendFile(__dirname+"/index.html");
})
app.post("/",function(req,res){
var num1=Number(req.body.num1);
var num2=Number(req.body.num2);
var result=num1+num2;
res.send(result);
})
app.listen(3000,function(){
console.log("server started");
})
When I am using the Number() function this error is raised. Can anybody help me with this?
I want the result to be shown in the localhost page