Share:This is part of the ‘Sweet & Sour mongoose.js methods’ series. In this function we will write a method that acts upon the UserSchema to check whether an email OR username already exists in the database. As an example use-case, this method can then be used in the any of your routes files by exporting the “User” to check whether an email address already exists
Share:I’ve been using Mongoose (ODM library for MongoDB) quite a bit for the authentication project. NoSQL databases like MongoDB do seem more flexible for web apps which depend quite a bit on user interaction. Example a user might decide to login with a social media account or register with their email, a password and secret question-answer. I find it way easier to write a mongoose
Share: To ignore remote changes and overwrite them git push origin –force The token conveyor belt: use hidden input fields to pass ‘info’ between POST & GET requests (if there is no user entered info into an input field which can be ‘gotten’ through req.body). Use case: in script.js assign the value of an element’s “innerHTML” property to be the value of a hidden input.
Share:This snippet is to conditionally render navbar items based on whether a user is logged in OR not. So toggle the ‘Login’ button to ‘Logout’ if the user is already logged in and vice versa. I admit it took more time that I had anticipated. Primarily because in the beginning I insisted on using a global variable in express to manage the user’s ‘isAuthenticated’ state
Share: What started out as a small module has become a month long project. Some days I sleep well, other days I keep a notebook besides me to jot down ideas. I’ll be putting this project up on Product Hunt and Gumtree as a stand alone module for other developers to use. Version 1.0 has the following features: User can make an account using their
Share:##Introduction note: work in progress So you have to code/make a website in 30 minutes for someone that scales on laptops, mobiles and tablets. What do you do? : Code your own front-end library overnight Use Twitter Bootstrap The answer is you use Twitter Bootstrap as you only have 30 minutes during lunch break. Because why do you want to waste your lunch break coding
Share:Introduction CSS3 Grid Layout is great for controlling layout with rows AND columns! 1. Create the structure of the layout (i.e. # of rows and columns) 2. Place items on the layout (manually or through auto placement) Forge on Getting started Placing items on a grid: “display:grid” Setting grid columns and rows: grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: auto; Note 1.Grid-template-columns and rows help define