Teaching Newbies since 2014

kauress

  • Home
  • Javascript ❤
    • JavaScript
    • Node.js
  • WebDev Tuts
  • screencasts
  • Resources
  • VR & AR
  • Contact
  • Github
  • Twitter
  • YouTube
  • RSS
  • C++
You are here: Home / Archives for Node Newbs

September 18, 2019 by: Kauress

Sweet & Sour mongoose.js methods – 2

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

[ Read More ]

September 8, 2019 by: Kauress

Sweet & Sour mongoose.js methods – 1

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

[ Read More ]

August 12, 2019 by: Kauress

Conditionally rendering EJS template with res.locals in express.js

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

[ Read More ]

July 27, 2019 by: Kauress

Simply Auth now on heroku!

Past week I’ve been fixing issues with the simply auth project now on heroku! https://simplyauth.herokuapp.com/ I will add a rate limiting feature to limit login attempts to 3 and call it a day with this project. Rate limiting helps with brute force attacks so that a request from the same I.P address cannot have an unlimited amount of login attempts. It also makes an ‘app’

[ Read More ]

June 17, 2019 by: Kauress

New project: Authentication from scratch

New project in progress… Vanilla JS project with: 3 Login strategies 2 password reset strategies Security precautions

[ Read More ]

May 19, 2019 by: Kauress

Line by Line: Node.js Server

[ Read More ]

April 29, 2019 by: Kauress

Newbie guide : socket.IO: Code a chat app – Part 2

Code a chat app Guide Introduction The features of the chat app Socket.IO methods Socket.IO events Callback functions Directory structure So far.. Set up index.html and style.css Sending a message from the client to the server Receiving the message from the client at the server Displaying the message to all connected clients Broadcasting “user is typing…” message Display greeting message when someone joins the chat

[ Read More ]

April 22, 2019 by: Kauress

Newbie guide: socket.IO

Guide Introduction What happens? Summary Set up the main project directory Install dependencies Directory structure Create a server in index.js Set up index.html Test your server 10.Make your first socket connection Conclusion Resources Note: This guide covers till setting up socket.IO to be used. A chat app using socket.IO will ensue in part 2 Introduction Socket.IO is a JavaScript library which allows real time bidirectional

[ Read More ]

Copyright © 2021 ·Kauress