reddit's Introduction
reddit's People
reddit's Issues
Passwords not hashed in the database
A couple of empty files
1- db_build.js
2- index.js in (helpers) folder.
Make sure you ignore any empty files instead of pushing them (although db_build should've had lots of code in it)
No button for homepage
After navigating to any page in the website, it's important I always have a button to return me to the homepage, and that button should be obviously seen on the top of the screen :)
Repeated code
Make sure to use variables or functions to store any repeated code ^^
const userId = req.originalUrl.split('/')[1];
const postId = req.originalUrl.split('/')[2];
better as
const IDs = req.originalUrl.split('/');
const userId = IDs[1];
const postId = IDs[2];
Indentation
I like your code, variables are well-named and the functions are easily readable, except that you might wanna work a bit more on the indentation :)
jwt.verify(cookie.parse(req.headers.cookie).token , process.env.SECRET, (error,result)=>{
if(error){res.render('login')}
else {
res.redirect('/loggedHome')
// var {body} = req.body;
// insert.insertPost(body,1,1,(error,result)=>{
// if(error)console.log(error);
// res.redirect('/');
}
})
}
}
Pretty sure you already have atom-beautify
:D
Unnecessary comments
Yes, comments can sometimes be very helpful. However, in the following code, these comments may only get you confused and make the file bigger when there's no need.
jwt.verify(cookie.parse(req.headers.cookie).token , process.env.SECRET, (error,result)=>{
if(error){res.render('login')}
else {
res.redirect('/loggedHome')
// var {body} = req.body;
// insert.insertPost(body,1,1,(error,result)=>{
// if(error)console.log(error);
// res.redirect('/');
}
})
}
}
Typos in variable names
Typos in naming variables can have very frustrating results and consume lots of time debugging. I'd recommend being a bit more careful about typos in your code :)
select.selecOneUser(id,result=>{
๐ t is missing in (selectOneUser)
No sign up
no start/launch script
in package.json
it seems like you forgot to add a launching script to start the app. It's important as a developer to have some pre-prepared scripts for your needs like start: node app.js
and watch: nodemon app.js
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.