index.js
762 Bytes
// index.js
var express = require('express');
var app = express();
app.set("view engine","ejs"); // 1
app.use(express.static(__dirname + '/public'));
// 2
app.use(express.json())
app.get("/index", function(req,res){
res.render("index");
});
app.get('/graph', function(req, res){
var payDay = req.query.payDay
var salary = req.query.salary
var workDay = req.query.workDay
var workTime = req.query.workTime
var offWork = req.query.offWork
//console.log(payDay, salary,workDay,workTime, offWork);
res.sendFile(__dirname + '/public/graph.html');
//res.send(`payDay : ${payDay}, salary : ${salary}, workDay : ${workDay}, workTime : ${workTime}, offWork : ${offWork}`);
})
app.listen(3000, function(){
console.log('Server On!');
});