This file contains 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 students = ["Mohan", "Ram", "Jeeva", "Priya"]; | |
//since students object is an iterable, we can use with iteration mechanism such as for, spread operators etc. | |
for (let student of students) { | |
console.log(student); | |
} | |
// prints | |
// "Mohan" | |
// "Ram" | |
// "Jeeva" |
This file contains 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 { useHistory } from "react-router-dom"; | |
import config from "../../config"; | |
const Dashboard = () => { | |
const [dashboard, setDashboard] = useState(null); | |
const history = useHistory(); | |
const logout = () => { |
This file contains 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
.container { | |
height: 100vh; | |
} | |
.loginFormContainer { | |
width: 24rem; | |
} | |
.loginFormLegend { | |
width: 14rem; |
This file contains 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, { useState } from "react"; | |
import { useHistory } from "react-router-dom"; | |
import styles from "./Login.module.css"; | |
import { useForm } from "react-hook-form"; | |
import { Link } from "react-router-dom"; | |
import config from "../../config"; | |
const Login = () => { |
This file contains 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, { useState } from "react"; | |
import styles from "./Register.module.css"; | |
import { useForm } from "react-hook-form"; | |
import { Link } from "react-router-dom"; | |
import config from "../../config"; | |
const Register = () => { | |
const { register, handleSubmit, errors } = useForm(); | |
const [message, setMessage] = useState(); |
This file contains 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
.container { | |
height: 100vh; | |
} | |
.registrationFormContainer { | |
width: 24rem; | |
} | |
.registrationFormLegend { | |
width: 14rem; |
This file contains 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 from "react"; | |
import styles from "./Register.module.css"; | |
import { Link } from "react-router-dom"; | |
const Register = () => ( | |
<div | |
className={`${styles.container} container-fluid d-flex align-items-center justify-content-center`} | |
> | |
<div className={styles.registrationFormContainer}> |
This file contains 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 router = require("express").Router(); | |
const User = require("../model/User"); | |
const bcrypt = require("bcryptjs"); | |
// validation | |
const { registerValidation, loginValidation } = require("../validation"); | |
// register route | |
router.post("/register", async (req, res) => { | |
// validate the user |
This file contains 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 userSchema = new mongoose.Schema({ | |
name: { | |
type: String, | |
required: true, | |
min: 6, | |
max: 255, | |
}, | |
email: { |
This file contains 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 { | |
Component, | |
OnInit, | |
OnChanges, | |
DoCheck, | |
AfterContentInit, | |
AfterContentChecked, | |
AfterViewInit, | |
AfterViewChecked, | |
OnDestroy |
NewerOlder