-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (26 loc) · 855 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let express = require("express");
let app = express();
let bisection = require("./methods/bisection");
let bodyParser = require('body-parser');
let initial_value, final_value;
app.use(bodyParser.urlencoded({extended: true}));
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/public'));
app.get("/", function(req, res){
res.render("methods/bisection/bisection");
});
app.get("/start", function(req, res){
let bisectionResults = bisection.start(initial_value, final_value);
res.render("methods/bisection/start", {results: bisectionResults});
});
app.post("/start", function(req, res){
initial_value = req.body.initial_value;
final_value = req.body.final_value;
res.redirect("/start");
});
app.get("/*", function(req, res){
res.send("Page not found");
});
app.listen(3000, function(){
console.log("Server Has Started");
});