Giter Site home page Giter Site logo

reddit's Introduction

Hi

Hi, this is Sallam ๐Ÿ‘‹

reddit's People

Contributors

sallamtanna avatar

reddit's Issues

Passwords not hashed in the database

The whole point of hashing is to hide passwords from people who have access to the database, so that even if you view the users table/tables you won't be able to figure out what password each user has.
db

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

In the user-story I can see I'm supposed to be able to sign up to the website and you even added a controller to it but when I enter the website.... ๐Ÿ˜• ?
su

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.