Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added nodeJS project about to-do list #72

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
Binary file added JavaScript/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions JavaScript/calculator/calculator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const express = require("express");
const bodyParser = require("body-parser");

const app = express();
app.use(bodyParser.urlencoded({extended: true})); //code for body-parser

app.get("/", function(req, res){
res.sendFile(__dirname+"/index.html");
});

app.post("/", function(req, res){
var num1 = Number(req.body.num1); //req.body fetches the data from the webpage
var num2 = Number(req.body.num2);
var sum = num1 + num2;
res.send("Yayy! the sum is: " + sum);
})

app.listen(3000, function(){
console.log("server is running on port: 3000");
})
17 changes: 17 additions & 0 deletions JavaScript/calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>calculator</title>
</head>
<body>
<h1>Calculator</h1>
<form action="/" method="POST">
<input type="text" name="num1" placeholder="enter first number">
<input type="text" name="num2" placeholder="enter second number">
<button type="submit" name="submit">calculate</button>
</form>
</body>
</html>
1 change: 1 addition & 0 deletions JavaScript/calculator/node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

236 changes: 236 additions & 0 deletions JavaScript/calculator/node_modules/accepts/HISTORY.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions JavaScript/calculator/node_modules/accepts/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading