Open in app

Sign In

Write

Sign In

Prakash Jha
Prakash Jha

2 Followers

Home

About

Apr 28, 2021

Javascript: understanding callbacks and event emitter

callbacks can be confusing and let’s try to understand it with an example without looking at the definition let's take a problem as i want to ask some questions to the user using CLI and at the end of the answers I display the answers said by him..now …

Java Script

3 min read

Java Script

3 min read


Apr 18, 2021

JS callback hell and how to handle it

you might have come across this term while getting started with js, here i’ll try to write less and show more in terms of coding so let’s take an example of chat application and in the post request you have a filtering for a specific word named as ‘badword’ lets…

Nodejs

2 min read

Nodejs

2 min read


Oct 11, 2020

Node.js and Express.js part 10

This part mainly focuses on API security but before doinf that we need to implement logout function for our cookies and also enable cookies functionality go to controllers/auth.js and add this part of code // @desc Log user out / clear cookie // @route…

3 min read

3 min read


Oct 6, 2020

Node.js and Express.js part 9

Let’s dive into reviewing our bootcamps — let’s first get started by getting all the reviews and reviews by bootcamps create models/Review.js const mongoose = require('mongoose'); const ReviewSchema = new mongoose.Schema({ title: { type: String, trim: true, required: [true, 'Please add a title for the review']…

Nodejs

6 min read

Nodejs

6 min read


Oct 5, 2020

Node.js and Express.js part 8

Bootcamp to user Relationship — we need to make out system like this that publisher can only post 1 bootcamp, admin can post any amount of Bootcamp, for that we need to include user in our bootcamp model in models/Bootcamps.js just add this one feild user: { type: mongoose.Schema.ObjectId, ref: 'User', required: true } in…

Authentication

8 min read

Authentication

8 min read


Oct 4, 2020

Node.js and Express.js part 7

working with user authentication using JWT — npm i jsonwebtoken bcryptjs here we will create user registration using JWT create new file models/User.js and add const mongoose = require('mongoose'); const UserSchema = new mongoose.Schema({ name: { type: String, required: [true, 'Please add a name'] }, email: {…

Nodejs

6 min read

Nodejs

6 min read


Oct 4, 2020

Node.js and Express.js part 6

Photo upload for bootcamp npm i express-fileupload now create a folder name public and in that folder create another folder named uploads and now in config/config.env add these two FILE_UPLOAD_PATH= ./public/uploads MAX_FILE_UPLOAD=1000000 now go to server.js and add these two above const path = require('path'); const fileupload = require('express-fileupload'); and these modules just above…

Nodejs

3 min read

Nodejs

3 min read


Sep 23, 2020

Node.js and Express.js part 5

creating the seeds for our database to add all the data in one go create seeder.js and add this const fs = require('fs'); const mongoose = require('mongoose'); const dotenv = require('dotenv'); // Load env vars dotenv.config({ path: './config/config.env' }); // Load models const Bootcamp = require('./models/Bootcamp'); // Connect to DB mongoose.connect(process.env.MONGO_URI…

Nodejs

13 min read

Nodejs

13 min read


Sep 23, 2020

Behavioral patterns

In software engineering, behavioral design patterns are design patterns that identify common communication patterns among objects. By doing so, these patterns increase flexibility in carrying out communication TEMPLATE PATTERN : In Template pattern, an abstract class exposes defined way(s)/template(s) to execute its methods. Its subclasses can override the method implementation as per need…

Design Patterns

8 min read

Behavioral pattern
Behavioral pattern
Design Patterns

8 min read


Sep 11, 2020

Node.js and Express.js part 4

to handle error in an efficient manner is to use middleware create middleware/error.js and add const errorHandler = (err, req, res, next) => { res.status(500).json({ sucess:false, error:err.message }); } module.exports = errorHandler; we just need to do 2 tweaks in server.js that to include the file and use it const…

Nodejs

4 min read

Nodejs

4 min read

Prakash Jha

Prakash Jha

2 Followers
Following
  • Maximiliano Contieri

    Maximiliano Contieri

  • Jon Brosio

    Jon Brosio

  • Markus Hanslik

    Markus Hanslik

  • Akhil Haridasan

    Akhil Haridasan

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech