-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
53 lines (34 loc) · 1.2 KB
/
server.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import {foutput} from './classifier.js'
import express from 'express'
import path from 'path'
const app = express()
let hostname = "127.0.0.1"
let port = "3000"
let __dirname = path.resolve()
app.set('view engine','ejs')
app.use(express.urlencoded())
app.use(express.static(path.join(__dirname, "public" )))
app.get('/home',(req,res) => {
res.sendFile(path.join(__dirname + '/home.html'))
})
app.get('/symptoms',(req,res) => {
res.sendFile(path.join(__dirname + '/symp.html'))
})
app.get('/about',(req,res) => {
res.sendFile(path.join(__dirname + '/about.html'))
})
app.get('/info',(req,res) => {
res.sendFile(path.join(__dirname + '/info.html'))
})
app.post("/result",(req,res) => {
console.log("symp", req.body)
let msg = Object.keys(req.body)
let output = foutput(msg.toString())
console.log('output',output)
let highP = output.slice(0,3)
let mediumP = output.slice(3,7)
let lowP = output.slice(7, output.length)
let data = {high: highP, med: mediumP, low: lowP}
res.render('output.ejs',{diseaseData: data})
})
app.listen(port,hostname,()=>console.log('Server Running at ' + hostname + ":" + port))