Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
efa46ca
Added basic app structure
keshavagarwal17 Feb 20, 2021
58d206f
Merge pull request #1 from The-Keshav-Agarwal/team#6
nlok5923 Feb 20, 2021
df58708
Connect To Database
keshavagarwal17 Feb 20, 2021
3c8522a
boostrap problem resolved
nlok5923 Feb 20, 2021
f1a44d4
Merge branch 'team#6' into creator-dev
nlok5923 Feb 20, 2021
d034567
test commit
nlok5923 Feb 20, 2021
15bec36
Merge pull request #2 from nlok5923/creator-dev
keshavagarwal17 Feb 20, 2021
4476884
add model
keshavagarwal17 Feb 20, 2021
a0acc69
Merge branch 'team#6' of https://github.com/The-Keshav-Agarwal/api-di…
keshavagarwal17 Feb 20, 2021
600bc00
merging changes
nlok5923 Feb 20, 2021
b44969f
remove errors
keshavagarwal17 Feb 20, 2021
b44c8f4
Merge branch 'team#6' of https://github.com/The-Keshav-Agarwal/api-di…
nlok5923 Feb 20, 2021
fddb58a
added register page
nlok5923 Feb 20, 2021
d73ed00
enhanced register file
nlok5923 Feb 20, 2021
9bc8af1
added backend for registration
nlok5923 Feb 20, 2021
4d56e42
added frontend for login
keshavagarwal17 Feb 20, 2021
fc20ec0
init :tada: dashboard
nlok5923 Feb 20, 2021
bc2d3ca
login with backend completed
keshavagarwal17 Feb 20, 2021
c44e446
login with backend completed
keshavagarwal17 Feb 20, 2021
1b70800
minor fixes
nlok5923 Feb 20, 2021
1934c0e
minor changes in styling
keshavagarwal17 Feb 20, 2021
87664f4
added page for adding symptoms
keshavagarwal17 Feb 21, 2021
377c1c6
minor update
keshavagarwal17 Feb 21, 2021
9d2070b
[WIP] Product selection page
nlok5923 Feb 21, 2021
ff90834
conflict resolved
nlok5923 Feb 21, 2021
b676baa
product seletion
nlok5923 Feb 21, 2021
7044a5b
partial work done for showing disease
keshavagarwal17 Feb 21, 2021
89e45d6
Merge branch 'team#6' of https://github.com/The-Keshav-Agarwal/api-di…
keshavagarwal17 Feb 21, 2021
d312c91
changed endpoint
nlok5923 Feb 21, 2021
eb78136
Showing disease according to symptoms
keshavagarwal17 Feb 21, 2021
aaaa78b
Merge branch 'team#6' of https://github.com/The-Keshav-Agarwal/api-di…
keshavagarwal17 Feb 21, 2021
4ba9c6d
minor update
keshavagarwal17 Feb 21, 2021
1c40c5b
adding multiple symptoms
nlok5923 Feb 21, 2021
27af8b1
conflict resolved
nlok5923 Feb 21, 2021
026dea7
change data type in model
keshavagarwal17 Feb 21, 2021
bf9bd60
add route for article according to disease
keshavagarwal17 Feb 21, 2021
344b030
unrelated changes
nlok5923 Feb 21, 2021
3b7929c
conflict resolved
nlok5923 Feb 21, 2021
1bd20d3
parsing quill text done
nlok5923 Feb 21, 2021
b6add44
remove all unnecessary comments and logs
keshavagarwal17 Feb 21, 2021
324cbe9
wastage
nlok5923 Feb 21, 2021
639c947
conflict resolved
nlok5923 Feb 21, 2021
c86f199
quill issue addressed
nlok5923 Feb 21, 2021
c1ce966
added all article page
nlok5923 Feb 21, 2021
32b9335
added sweet alert feature
nlok5923 Feb 21, 2021
476b6d8
ultra-minute changes done
nlok5923 Feb 21, 2021
9bfbaf8
not working like/dislike code
keshavagarwal17 Feb 21, 2021
4abaa5c
remove conflicts
keshavagarwal17 Feb 21, 2021
688962f
minor update
keshavagarwal17 Feb 21, 2021
82b0400
working
nlok5923 Feb 21, 2021
3b6a7a5
Merge branch 'team#6' of https://github.com/The-Keshav-Agarwal/api-di…
nlok5923 Feb 21, 2021
3cce476
woking
nlok5923 Feb 21, 2021
06a2e38
add like/dislike
keshavagarwal17 Feb 21, 2021
c2233e9
Added features of website in readme
nlok5923 Feb 21, 2021
289d1da
working
nlok5923 Feb 21, 2021
cdad89a
minor changes
keshavagarwal17 Feb 21, 2021
69f5720
merging
keshavagarwal17 Feb 21, 2021
3de4fc8
minor errors
keshavagarwal17 Feb 21, 2021
d07830c
issue resolved
nlok5923 Feb 21, 2021
bc68eb8
Added instruction to run code
keshavagarwal17 Feb 21, 2021
644db55
Update README.md
keshavagarwal17 Feb 21, 2021
474d751
Update README.md
keshavagarwal17 Feb 21, 2021
2507228
Update README.md
keshavagarwal17 Feb 21, 2021
10e69a2
push to heroku
keshavagarwal17 Feb 21, 2021
f7d19eb
change token and deploy on heroku
keshavagarwal17 Feb 21, 2021
bb10b46
Merge branch 'team#6' of https://github.com/The-Keshav-Agarwal/api-di…
keshavagarwal17 Feb 21, 2021
ba85418
local -> global
nlok5923 Feb 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions team#6 - {2}/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
55 changes: 55 additions & 0 deletions team#6 - {2}/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## THEME: HEALTHCARE

### Problem statement identified:

<p>With the growing lifestyle and comfort in day to day life humans are becoming weak and prone to health related issues Also in urban cities once a person got a little cold too he immediately approaches the specialist for his treatment which then suggest him to take allopathic medicines/steriod to get cured for an utter normal disease too like cold. </p><br>

<p>Also with time the importance of home made medicine so called (dadi/nani ke nuske) for treatment of small disease lie cought, cold, headache ,stomach ache are draining .Instead using those can prove to be much effective as well as useful as they are homemade and made of natural products </p>

### Solution:
<h3>One stop solution e-doctor </h3>
<p> This is the website made for the purpose of preserving our own medicinal culture and help each other for the treatment of small diseases.</p>

<h4>What does e doctor does ? <h4>
<p>It is a platform where user can register himself, know the disease he may have based on symptoms and get a guide how he can get cured from it through home made medicines</p>

<h5>Working </h5>
<p>Once user arrive he will be greeted with the landing page and the he/she can register themselves on registering onwards they can login themselves with proper credentials once login done they will be at dashboard where they had two options one to diagnose himself and other to add article on one of the home made medicine(article includes how to make that medicine what are the benefits of medicine, what the article is actaully for ect). suppose he move with diagnose then he need to choose the symptoms he/she is experiencing and based upon the symptoms he will receive the name of disease of which he can a patient of once getting disease information if the home medicinal cure article is availiable then he can receive the same by clicking on disease card (card displaying disease information) and follow accordingly to get cure on the other hand if he chooses to add an article he can do so by clicking on add article and put necessary information about the home medicine therapy he is also provided with feature to add ingredients information needed to make the medicine in the next step of the form where whether he can manually add the links with name or just select among already present products </p>

<h4>features: </h4>
<ul>
<li>User will get information regarding disease he may have from symptoms </li>
<li>Old home medicine culture is feature in the way article on it formed</li>
<li>Every article can be liked or disliked so that user can get the most trusted articles</li>
<li>Ingredients details(needed for making medicine) can be added with article</li>
<li> Login and sign up facility for user </li>
</ul>

### Step To Run Code
As we are using free api so token is expires after some time so in order to run this code you have to generate your own token.<br>
<h4>Step To Create Token</h4>
<p>go to <a href="https://apimedic.com/">apimedic.com</a> and create your account. If you already have an account on <a href="https://apimedic.com/">apimedic.com</a> then login with the same.<br>

After signup/login go to <a href="https://apimedic.com/apikeys">here</a> and copy your Sandbox Password.<br>

then go to <a href="https://sandbox-authservice.priaid.ch/docs.html">here.</a> and scroll down to the bottom of the page.<br>

Enter your email as username and sandbox password as password and click on generate Token.</p>

<h5>Step To Download Code</h5>
<p>Clone this repo using <b>git clone https://github.com/The-Keshav-Agarwal/api-digest-2021.git</b></p>

Change branch to `team#6` using `git checkout team#6`<br>

Change Directory to `api-digest-2021/team$6 - {2}`, using `cd "api-digest-2021/team#6 - {2}"`<br>

Install All the dependencies using `npm i`.<br>

Replace the token with your token in `routes/dashboard.js` at 22 line.<br>

Start the app using `nodemon index`

Now go to <a href="http://localhost:3000/">localhost:3000</a> and explore each and every feature of <b>E-Doctor</b>



43 changes: 43 additions & 0 deletions team#6 - {2}/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
const mongoose = require("mongoose");
var logger = require('morgan');
var bodyParser = require('body-parser')
var path = require('path')
const cookieParser = require("cookie-parser")
const registerRouter = require('./routes/register')
const {checkUser} = require("./middleware/authMiddleware");
const landingRouter = require('./routes/landing')
const dashboardRouter = require('./routes/dashboard')

mongoose.connect("mongodb+srv://user:pass123@cluster0.alsmz.mongodb.net/myFirstDatabase",{
useNewUrlParser:true,
useUnifiedTopology:true
})
.then(()=>{
console.log("Connected With Database");
})
.catch(err=>{
console.log("Error while connecting to database ",error);
})

app.set("view engine","ejs");
app.use(express.static("public"));
app.use(bodyParser.json({ limit: '10mb', extended: true }));
app.use(bodyParser.urlencoded({ limit: '10mb', extended: true }));
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.urlencoded({extended:false}));
app.use(cookieParser());
app.get('*',checkUser);

app.use('/',landingRouter);
app.use('/register',registerRouter)
app.use('/dashboard',dashboardRouter)
app.use("/auth",require("./routes/auth"));



app.listen(port,(req,res)=>{
console.log(`Server is running on port ${port}`);
})
61 changes: 61 additions & 0 deletions team#6 - {2}/middleware/authMiddleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const jwt = require("jsonwebtoken");
const userData = require("../models/user");

const ensureAuth = (req,res,next)=>{
const token = req.cookies.jwt;
if(token){
jwt.verify(token,"MySecretPassword",(err,decodedToken)=>{
if(err){
console.log(err.message);
res.redirect("/auth/login");
}else{
next();
}
})
}else{
res.redirect("/auth/login");
}
}

const ensureGuest = (req,res,next)=>{
const token = req.cookies.jwt;
if(token){
jwt.verify(token,"MySecretPassword",(err,decodedToken)=>{
if(err){
console.log(err.message);
next();
}else{
res.redirect("/dashboard");
}
})
}else{
next();
}
}

const checkUser = (req,res,next)=>{
const token = req.cookies.jwt;
if(token){
jwt.verify(token,"MySecretPassword",async(err,decodedToken)=>{
if(err){
console.log(err.message);
res.locals.user = null;
next();
}else{
try {
const result = await userData.find({_id:decodedToken.id});
res.locals.user = result[0];
next();
} catch (error) {
res.locals.user = null;
console.log(error);
}
}
})
}else{
res.locals.user = null;
next();
}
}

module.exports = {ensureAuth,checkUser,ensureGuest};
42 changes: 42 additions & 0 deletions team#6 - {2}/models/article.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const articleData = new Schema({
email:{
type:String,
default:null,
required:true
},
data:{
type:String,
default:null,
required:true
},
disease_id:{
type:Number,
default:null,
required:true
},
products: Schema.Types.Mixed,
id:{
type:String,
default: null,
required: true
},
rating:{
type:Number,
default:0
},
votes:[{
id:String,
like:Boolean,
dislike:Boolean
}],
dtitle:{
type:String,
default:null,
required: true
}
})

module.exports = mongoose.model('articleData',articleData);
32 changes: 32 additions & 0 deletions team#6 - {2}/models/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const userData = new Schema({
name:{
type:String,
default:null,
required:true
},
email:{
type:String,
default:null,
required:true
},
password:{
type:String,
default:null,
required:true
},
gender:{
type:String,
default:null,
required:true
},
date:{
type:Date,
default:null,
required:true
}
})

module.exports = mongoose.model('userData',userData);
Loading