This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require("mongoose"); | |
| const { Schema } = mongoose; | |
| // define a course schema | |
| const courseSchema = new Schema({ | |
| name: { | |
| type: String, | |
| required: true, | |
| }, | |
| description: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useEffect, useState } from 'react'; | |
| import axios from 'axios'; | |
| import { useParams } from 'react-router-dom'; | |
| import { toast } from 'react-toastify'; | |
| import './UserProfile.css'; | |
| const UserProfile = () => { | |
| const [userData, setUserData] = useState({}); | |
| const [postData, setPostData] = useState([]); | |
| const [isLoading, setIsLoading] = useState(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bcrypt = require('bcrypt'); | |
| const User = require('../models/userModel'); | |
| const { successResponse, errorResponse, createToken } = require('../utilities/utils'); | |
| const { signUpValidation, signInValidation } = require('../validator/userValidator'); | |
| const signUp = async (req, res, next) => { | |
| try { | |
| // 1. Get data from req.body | |
| const { name, email, password } = req.body; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| // Define a schema | |
| const userSchema = new mongoose.Schema({ | |
| name: { | |
| type: String, | |
| required: [true, 'name field should not be empty'], | |
| minLength: 4, | |
| maxLength: 30, | |
| lowercase: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Write API for Registration adn Login page of the application. | |
| 1.create a registration | |
| name | |
| age | |
| password: | |
| 2.create a sigin and verify that if user is there database login to website |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import dotenv from 'dotenv'; | |
| dotenv.config(); | |
| import express from 'express'; | |
| import cors from 'cors'; | |
| import { BSON, MongoClient } from 'mongodb'; | |
| const MONGO_URL = process.env.DATABASE_URI; | |
| const MONGO_PASSWORD = process.env.DATABASE_PASSWORD; | |
| const PORT = 9999 || process.env.PORT; | |
| // Initiate app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| flipkart> db.users.find() | |
| [ | |
| { | |
| _id: ObjectId("649588837ef25cfc573be8ab"), | |
| name: 'Vicki Lakin', | |
| email: 'Xzavier_Hauck14@hotmail.com', | |
| address: 'Estonia', | |
| password: 'n95mt3468ZzAIwu' | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use employeedb; | |
| show tables; | |
| show table status; | |
| -- Create table into db | |
| create table employee( | |
| id int unsigned not null auto_increment, | |
| username varchar(30) not null, | |
| age int unsigned not null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name": "Grant Barton", | |
| "attendence": true, | |
| "task_completed": true, | |
| "date_from": "2023-06-20T19:14:05.182Z", | |
| "date_to": "2023-08-04T06:12:13.144Z", | |
| "id": "1" | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": 1, | |
| "Name": "Tiger Nixon", | |
| "Position": "System Architect", | |
| "Office": "Edinburgh", | |
| "Age": 61, | |
| "StartDate": "2011/04/25", | |
| "Salary": "$320,800" | |
| }, |
NewerOlder