Skip to content

Commit 1a9ae91

Browse files
author
iamdyt
committed
Update Diagnose me
1 parent 1dcffa7 commit 1a9ae91

31 files changed

+11173
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

controllers/Diagnosis.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const knexoption = require ('../knexfile');
2+
const knex = require('knex')(knexoption);
3+
4+
module.exports = {
5+
index: async (req,res)=>{
6+
const questions = await knex('questions').where('Type','Gonorrhea').select('*');
7+
res.render('diagnosis/index', {questions});
8+
},
9+
10+
diagnose:(req,res)=>{
11+
const params = req.body.answer;
12+
if (params.length<4){
13+
const text = "You do not have Gonorrhea";
14+
res.render('diagnosis/result', {text});
15+
}
16+
else if (params.length < 7){
17+
const text = "You show Signs of Early Gonorrhea";
18+
res.render('diagnosis/result', {text});
19+
}
20+
21+
else{
22+
const text = "You have been infected with Gonorrea";
23+
res.render('diagnosis/result', {text});
24+
}
25+
}
26+
}

controllers/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
index:(req,res)=>{
3+
res.render('index');
4+
}
5+
}

dbconfig.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const knexoption = require ('../knexfile');
2+
const knex = require('knex')(knexoption);

knexfile.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
options = {
2+
client:'mysql',
3+
version:'2.17.1',
4+
connection:{
5+
host:'127.0.0.1',
6+
user:'root',
7+
password:'',
8+
database:'expert'
9+
},
10+
};
11+
12+
module.exports = options;

0 commit comments

Comments
 (0)