admin

Create a Footer Component in React JS Using Flowbite

How to Create a Footer Component in React JS Using Flowbite

1. Create a Footer.jsx inside the components folder. 2. Add Footer component in App.jsx 3. Go on Flowbite website in Footer components, choose footer design. 4. Copy Footer code and paste it in Footer.jsx. 5. Customize Logo image, URLs, Links, etc. Footer.jsx:- import { Footer } from ‘flowbite-react’; import { BsDribbble, BsFacebook, BsGithub, BsInstagram, BsTwitter

How to Create a Footer Component in React JS Using Flowbite Read More »

How to Add Functionality to the Sign-Up Page?

How to Add Functionality to the Sign-Up Page?

1. Update form text input type email field type=’email’password=’password’. Add type=’submit’ in form button 2. Define onChange function in all text input – onChange={handleChange} 3. Add this function in the starting of signup function andbefore return statement –   const [formData, setFormData]=useState({})   const handleChange=(e)=>{     setFormData({…formData, [e.target.id]:e.target.value.trim()})   };   console.log(formData) 4. add

How to Add Functionality to the Sign-Up Page? Read More »

How to Create Signup Page UI in React JS

How to Create Signup Page UI in React JS

Here is code for signup.jsx: import React from ‘react’import {Button, Label, TextInput} from ‘flowbite-react’import { Link } from ‘react-router-dom’ const Signup = () => {  return (    <div className=’ max-w-3xl mx-auto flex flex-col md:flex-row mt-20 gap-3 p-3′>        <div className=’ flex-1 flex items-center justify-center flex-col gap-3′>        <Link to=’/’>   

How to Create Signup Page UI in React JS Read More »

How to add a Middleware and a Function to Handle Errors

How to add a Middleware and a Function to Handle Errors?

Write a function in index.js:- app.use((err, req, res, next)=>{    const statusCode=err.statusCode || 500;    const message=err.message || “Internal Server Error”;    res.status(statusCode).json({        success:false,        statusCode,        message    })})   Add “next” parameter in signup function in “auth.controller.js” – Add next in catch –   Create a folder

How to add a Middleware and a Function to Handle Errors? Read More »

How to Hash Password in React JS MERN

How to Hash Password in React JS MERN

Install a package – npm i bcryptjs import it in auth.controller.js – import bcryptjs from ‘bcryptjs’ Add marked two line of code for hash the password – Complete code for auth.controller.js: import User from ‘../models/user.model.js’ import bcryptjs from ‘bcryptjs’ export const signup=async(req, res)=>{ const {username, email, password}=req.body; if(!username || !email || !password || username===” ||

How to Hash Password in React JS MERN Read More »

How to Create a SignUp API in React JS MERN

How to Create a SignUp API in React JS MERN?

Create a route file “auth.route.js” in “routes” folder. auth.route.js: – import express from ‘express’ import { signup } from ‘../controllers/auth.controller.js’; const router=express.Router(); router.post(‘/signup’, signup); export default router; ——- Create a file “auth.controller.js” in “controllers” folder. auth.controller.js: import User from ‘../models/user.model.js’ export const signup=async(req, res)=>{ const {username, email, password}=req.body; if(!username || !email || !password || username===”

How to Create a SignUp API in React JS MERN? Read More »

How to Create a Test API in React JS MERN

How to Create a Test API in React JS MERN

Add below given text in index.js: – app.get(‘/test’, (req, res)=>{ res.json({message:”API is working”}) }) Create a folder “routes” in “api” folder. Create a file “user.route.js” in “routes” folder. Write code in user.route.js – import express from ‘express’ const router=express.Router(); router.get(‘/test’, (req, res)=>{ res.json({message:”API is working”}) ) export default router;   import “user.route.js” in index.js import

How to Create a Test API in React JS MERN Read More »