├── README.md ├── nextjs-intro ├── styles │ ├── Login.module.css │ ├── globals.css │ └── Home.module.css ├── .eslintrc.json ├── public │ ├── nature.jpg │ ├── favicon.ico │ └── vercel.svg ├── next.config.js ├── pages │ ├── courses │ │ └── web-development.js │ ├── _app.js │ ├── api │ │ └── hello.js │ ├── Login.js │ └── index.js ├── package.json ├── .gitignore └── README.md ├── test1 ├── todo-app ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── index.html ├── src │ ├── setupTests.js │ ├── App.test.js │ ├── index.css │ ├── reportWebVitals.js │ ├── index.js │ ├── App.css │ └── App.js ├── .gitignore ├── package.json └── README.md ├── dodo-app ├── client │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── index.html │ ├── src │ │ ├── assets │ │ │ ├── logo.png │ │ │ ├── landing.jpg │ │ │ └── login.png │ │ ├── util │ │ │ ├── GetUser.js │ │ │ └── GetError.js │ │ ├── setupTests.js │ │ ├── App.test.js │ │ ├── pages │ │ │ ├── Landing │ │ │ │ ├── Landing.module.css │ │ │ │ └── Landing.jsx │ │ │ ├── Auth │ │ │ │ ├── Login.module.css │ │ │ │ ├── Login.jsx │ │ │ │ └── Register.jsx │ │ │ └── ToDo │ │ │ │ ├── ToDoList.module.css │ │ │ │ └── ToDoList.jsx │ │ ├── index.css │ │ ├── reportWebVitals.js │ │ ├── services │ │ │ ├── authServices.js │ │ │ └── toDoServices.js │ │ ├── App.js │ │ ├── index.js │ │ ├── components │ │ │ └── Navbar.jsx │ │ └── App.css │ ├── .gitignore │ ├── package.json │ └── README.md ├── routes │ ├── authRoutes.js │ └── ToDoRoutes.js ├── .gitignore ├── models │ ├── ToDoList.js │ └── User.js ├── package.json ├── middleware │ └── authJwt.js ├── server.js └── controllers │ ├── toDoController.js │ └── authController.js ├── mern-tutorial ├── frontend │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── index.html │ ├── src │ │ ├── components │ │ │ └── Navbar.jsx │ │ ├── index.js │ │ ├── App.js │ │ ├── Pages │ │ │ ├── home.css │ │ │ ├── Blogs.jsx │ │ │ └── Home.jsx │ │ ├── index.css │ │ └── App.css │ ├── .gitignore │ ├── package.json │ └── README.md └── backend │ ├── models │ ├── index.js │ └── SingleBlog.js │ ├── package.json │ ├── server.js │ └── package-lock.json ├── google-oauth-passport-js ├── client │ └── index.html ├── package.json ├── auth.js ├── index.js └── package-lock.json ├── custom-countdown-project ├── index.html ├── style.css └── script.js └── Ilas /README.md: -------------------------------------------------------------------------------- 1 | Web Development Projects 2 | -------------------------------------------------------------------------------- /nextjs-intro/styles/Login.module.css: -------------------------------------------------------------------------------- 1 | .heading1{ 2 | color: red; 3 | } -------------------------------------------------------------------------------- /nextjs-intro/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /test1: -------------------------------------------------------------------------------- 1 | Hello this is my first file creating in branch as contributor and 2 | commiting diretly to branch. 3 | -------------------------------------------------------------------------------- /todo-app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /dodo-app/client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /todo-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/todo-app/public/favicon.ico -------------------------------------------------------------------------------- /todo-app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/todo-app/public/logo192.png -------------------------------------------------------------------------------- /todo-app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/todo-app/public/logo512.png -------------------------------------------------------------------------------- /mern-tutorial/frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /nextjs-intro/public/nature.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/nextjs-intro/public/nature.jpg -------------------------------------------------------------------------------- /nextjs-intro/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/nextjs-intro/public/favicon.ico -------------------------------------------------------------------------------- /dodo-app/client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/dodo-app/client/public/favicon.ico -------------------------------------------------------------------------------- /dodo-app/client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/dodo-app/client/public/logo192.png -------------------------------------------------------------------------------- /dodo-app/client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/dodo-app/client/public/logo512.png -------------------------------------------------------------------------------- /dodo-app/client/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/dodo-app/client/src/assets/logo.png -------------------------------------------------------------------------------- /dodo-app/client/src/assets/landing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/dodo-app/client/src/assets/landing.jpg -------------------------------------------------------------------------------- /dodo-app/client/src/assets/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/dodo-app/client/src/assets/login.png -------------------------------------------------------------------------------- /mern-tutorial/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/mern-tutorial/frontend/public/favicon.ico -------------------------------------------------------------------------------- /mern-tutorial/frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/mern-tutorial/frontend/public/logo192.png -------------------------------------------------------------------------------- /mern-tutorial/frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodersArts/Web-Development/HEAD/mern-tutorial/frontend/public/logo512.png -------------------------------------------------------------------------------- /dodo-app/client/src/util/GetUser.js: -------------------------------------------------------------------------------- 1 | export function getUserDetails(){ 2 | let user = JSON.parse(localStorage.getItem('toDoAppUser')); 3 | return user; 4 | } -------------------------------------------------------------------------------- /nextjs-intro/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | } 5 | 6 | module.exports = nextConfig 7 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/components/Navbar.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | function Navbar () { 4 | return

Navbar

; 5 | } 6 | 7 | export default Navbar; 8 | -------------------------------------------------------------------------------- /nextjs-intro/pages/courses/web-development.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | function web () { 4 | return

web-development

; 5 | } 6 | 7 | export default web; 8 | -------------------------------------------------------------------------------- /nextjs-intro/pages/_app.js: -------------------------------------------------------------------------------- 1 | import '../styles/globals.css' 2 | 3 | function MyApp({ Component, pageProps }) { 4 | return 5 | } 6 | 7 | export default MyApp 8 | -------------------------------------------------------------------------------- /nextjs-intro/pages/api/hello.js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | export default function handler(req, res) { 4 | res.status(200).json({ name: 'John Doe' }) 5 | } 6 | -------------------------------------------------------------------------------- /mern-tutorial/backend/models/index.js: -------------------------------------------------------------------------------- 1 | const mongoose = require ('mongoose'); 2 | mongoose.Promise = global.Promise; 3 | 4 | let db = {}; 5 | 6 | db.mongoose = mongoose; 7 | 8 | db.SingleBlog = require ('./SingleBlog'); 9 | 10 | module.exports = db; 11 | -------------------------------------------------------------------------------- /dodo-app/client/src/util/GetError.js: -------------------------------------------------------------------------------- 1 | export function getErrorMessage (error) { 2 | const msg = 3 | (error.response && error.response.data && error.response.data.message) || 4 | error.message || 5 | error.toString (); 6 | return msg; 7 | } 8 | -------------------------------------------------------------------------------- /todo-app/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /dodo-app/client/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /todo-app/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /dodo-app/client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /dodo-app/routes/authRoutes.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const AuthController = require('../controllers/AuthController'); 3 | const router = express.Router(); 4 | 5 | 6 | router.post('/register',AuthController.registerUser) 7 | router.post('/login',AuthController.loginUser) 8 | 9 | 10 | module.exports = router; 11 | -------------------------------------------------------------------------------- /nextjs-intro/pages/Login.js: -------------------------------------------------------------------------------- 1 | import Head from "next/head"; 2 | import styles from '../styles/Login.module.css' 3 | 4 | function Login () { 5 | return ( 6 | <> 7 | 8 | Login 9 | 10 |

Login

11 | 12 | 13 | ); 14 | } 15 | 16 | export default Login; 17 | -------------------------------------------------------------------------------- /nextjs-intro/styles/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | } 8 | 9 | a { 10 | color: inherit; 11 | text-decoration: none; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import {BrowserRouter} from 'react-router-dom'; 6 | 7 | const root = ReactDOM.createRoot (document.getElementById ('root')); 8 | root.render ( 9 | 10 | 11 | 12 | ); 13 | -------------------------------------------------------------------------------- /dodo-app/client/src/pages/Landing/Landing.module.css: -------------------------------------------------------------------------------- 1 | .landing__wrapper{ 2 | display:flex; 3 | flex-wrap: wrap; 4 | margin-top: 100px; 5 | padding: 2rem; 6 | } 7 | 8 | .landing__text{ 9 | width: 40%; 10 | } 11 | 12 | .landing__text h1{ 13 | font-size: 4rem; 14 | } 15 | 16 | .landing__img{ 17 | width: 50%; 18 | margin-left: 2rem; 19 | 20 | } 21 | 22 | .landing__img img{ 23 | width: 100%; 24 | } -------------------------------------------------------------------------------- /todo-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /dodo-app/client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /mern-tutorial/backend/models/SingleBlog.js: -------------------------------------------------------------------------------- 1 | const mongoose = require ('mongoose'); 2 | 3 | const SingleBlog = new mongoose.Schema ( 4 | { 5 | title: { 6 | type: String, 7 | }, 8 | category: { 9 | type: String, 10 | }, 11 | description: { 12 | type: String, 13 | }, 14 | }, 15 | { 16 | timestamps: true, 17 | } 18 | ); 19 | 20 | module.exports = mongoose.model ('SingleBlog', SingleBlog); 21 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import { Route, Routes } from 'react-router'; 2 | import './App.css'; 3 | import Blogs from './Pages/Blogs'; 4 | import Home from './Pages/Home'; 5 | 6 | function App () { 7 | return ( 8 | <> 9 | 10 | } /> 11 | } /> 12 | 13 | 14 | ); 15 | } 16 | 17 | export default App; 18 | -------------------------------------------------------------------------------- /todo-app/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /dodo-app/client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /google-oauth-passport-js/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Google OAuth2 8 | 9 | 10 |

Google Oauth 2 with Passportjs

11 | Login with Google 12 | 13 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /todo-app/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /dodo-app/client/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/Pages/home.css: -------------------------------------------------------------------------------- 1 | form{ 2 | padding: 1rem; 3 | border:1px solid rgb(46, 45, 45); 4 | margin-left: auto; 5 | margin-right: auto; 6 | display:block; 7 | width:50%; 8 | 9 | } 10 | 11 | .form-control{ 12 | background-color: whitesmoke; 13 | width:90%; 14 | padding:10px; 15 | margin:10px; 16 | display: block; 17 | border:none; 18 | } 19 | 20 | label{ 21 | font-weight: bold; 22 | } -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /google-oauth-passport-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "work-folder", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "nodemon index.js" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "dotenv": "^16.0.3", 13 | "express": "^4.18.2", 14 | "express-session": "^1.17.3", 15 | "passport": "^0.6.0", 16 | "passport-google-oauth2": "^0.2.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dodo-app/client/src/services/authServices.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const SERVER_URL = 'http://localhost:5000/api'; 4 | 5 | 6 | const registerUser = (data)=>{ 7 | return axios.post(SERVER_URL+'/register',data); 8 | } 9 | 10 | const loginUser = (data)=>{ 11 | return axios.post(SERVER_URL+'/login',data); 12 | } 13 | 14 | 15 | const AuthServices = { 16 | registerUser, 17 | loginUser 18 | } 19 | 20 | 21 | export default AuthServices; 22 | 23 | 24 | -------------------------------------------------------------------------------- /mern-tutorial/backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "nodemon server.js" 9 | }, 10 | "author": "codersarts", 11 | "license": "ISC", 12 | "dependencies": { 13 | "cors": "^2.8.5", 14 | "express": "^4.18.1", 15 | "mongodb": "^4.8.1", 16 | "mongoose": "^6.5.2" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /nextjs-intro/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nextjs-intro", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "next": "12.1.6", 13 | "react": "18.2.0", 14 | "react-dom": "18.2.0" 15 | }, 16 | "devDependencies": { 17 | "eslint": "8.18.0", 18 | "eslint-config-next": "12.1.6" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dodo-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | #client dependencies 9 | /client/node_modules 10 | 11 | # testing 12 | /coverage 13 | 14 | # production 15 | /build 16 | 17 | # misc 18 | .DS_Store 19 | .env 20 | .env.local 21 | .env.development.local 22 | .env.test.local 23 | .env.production.local 24 | 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | -------------------------------------------------------------------------------- /nextjs-intro/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | -------------------------------------------------------------------------------- /dodo-app/models/ToDoList.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const {Schema} = mongoose; 3 | 4 | const toDoSchema = new Schema({ 5 | title:{type:String,required:true}, 6 | description:{type:String,required:true}, 7 | isCompleted:{type:Boolean,required:true}, 8 | completedOn:String, 9 | createdBy:{ 10 | ref:"User", 11 | type:Schema.ObjectId 12 | } 13 | }, 14 | { 15 | timestamps:true 16 | }); 17 | 18 | 19 | const ToDo = mongoose.model("ToDo",toDoSchema); 20 | 21 | module.exports = ToDo; -------------------------------------------------------------------------------- /dodo-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo-app-work-folder", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "dev": "nodemon start server.js", 9 | "start": "node server.js" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "bcrypt": "^5.1.1", 15 | "cors": "^2.8.5", 16 | "dotenv": "^16.3.1", 17 | "express": "^4.18.2", 18 | "jsonwebtoken": "^9.0.2", 19 | "mongoose": "^7.6.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dodo-app/routes/ToDoRoutes.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const {createToDo, getAllToDo,deleteToDo,updateToDo} = require('../controllers/toDoController'); 3 | const authenticateToken = require('../middleware/authJwt'); 4 | const router = express.Router(); 5 | 6 | 7 | router.post('/create-to-do',authenticateToken,createToDo) 8 | router.get('/get-all-to-do/:userId',authenticateToken,getAllToDo); 9 | router.delete('/delete-to-do/:id',authenticateToken,deleteToDo); 10 | router.patch('/update-to-do/:id',authenticateToken,updateToDo); 11 | 12 | 13 | 14 | module.exports = router; 15 | -------------------------------------------------------------------------------- /dodo-app/middleware/authJwt.js: -------------------------------------------------------------------------------- 1 | const jwt = require('jsonwebtoken'); 2 | require('dotenv').config(); 3 | const secretKey = process.env.JWT_SECRET; 4 | 5 | 6 | 7 | const authenticateToken = async (req,res,next)=>{ 8 | let token = req.header('Authorization'); 9 | if(!token) return res.status(401).send({message:'Authentication Failed!'}); 10 | 11 | jwt.verify(token,secretKey,(err,user)=>{ 12 | if(err) return res.status(403).send({message:"Token is not valid! Please Login again!"}); 13 | req.user = user; 14 | next(); 15 | }) 16 | 17 | } 18 | 19 | 20 | module.exports = authenticateToken; -------------------------------------------------------------------------------- /todo-app/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /todo-app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /dodo-app/client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /dodo-app/client/src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {Route, Routes} from 'react-router'; 3 | import Landing from './pages/Landing/Landing'; 4 | import Login from './pages/Auth/Login'; 5 | import Register from './pages/Auth/Register'; 6 | import ToDoList from './pages/ToDo/ToDoList'; 7 | import './App.css'; 8 | import 'antd/dist/reset.css'; 9 | function App() { 10 | return ( 11 | 12 | } /> 13 | } /> 14 | } /> 15 | } /> 16 | 17 | 18 | ) 19 | } 20 | 21 | export default App -------------------------------------------------------------------------------- /dodo-app/client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | import {BrowserRouter} from 'react-router-dom'; 7 | 8 | const root = ReactDOM.createRoot(document.getElementById('root')); 9 | root.render( 10 | 11 | 12 | 13 | 14 | 15 | ); 16 | 17 | // If you want to start measuring performance in your app, pass a function 18 | // to log results (for example: reportWebVitals(console.log)) 19 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 20 | reportWebVitals(); 21 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .primaryBtn{ 2 | padding:10px; 3 | background-color: rgb(0, 132, 255); 4 | color:white; 5 | border:none; 6 | margin:10px; 7 | cursor: pointer; 8 | } 9 | 10 | .primaryBtn:hover{ 11 | background-color: rgb(3, 101, 194); 12 | } 13 | 14 | .cardGroup{ 15 | display: flex; 16 | flex-wrap: wrap; 17 | } 18 | 19 | .card{ 20 | width:300px; 21 | margin:15px; 22 | padding:10px; 23 | border: 1px solid lightgray; 24 | } 25 | 26 | .card p{ 27 | color:rgb(73, 72, 72); 28 | } 29 | 30 | .card small{ 31 | background: rgb(101, 131, 228); 32 | padding:5px 10px; 33 | font-weight: bold; 34 | color: white; 35 | border-radius: 5px; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /nextjs-intro/pages/index.js: -------------------------------------------------------------------------------- 1 | import styles from '../styles/Home.module.css'; 2 | import Link from 'next/link'; 3 | import Head from 'next/head'; 4 | import Image from 'next/image'; 5 | import nature from '../public/nature.jpg'; 6 | 7 | export default function Home () { 8 | return ( 9 |
10 | 11 | Home 12 | 13 | 14 |

Hello Nextjs

15 | 16 |

Login

17 | 18 | 19 | nature 26 | 27 |
28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /dodo-app/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const cors = require('cors'); 4 | const mongoose = require('mongoose'); 5 | const authRoutes = require('./routes/authRoutes'); 6 | const toDoRoutes = require('./routes/ToDoRoutes'); 7 | require('dotenv').config(); 8 | 9 | const PORT = process.env.PORT || 5000; 10 | 11 | app.use(cors()); 12 | app.use(express.json()); 13 | 14 | app.use('/api',authRoutes); 15 | app.use('/api/todo',toDoRoutes); 16 | mongoose.connect(process.env.DB_URL).then((result)=>{ 17 | console.log("DB Connected Successfully!"); 18 | }).catch(err=>{ 19 | console.log(err); 20 | }) 21 | 22 | app.listen(PORT,()=>{ 23 | console.log(`Server started at port ${PORT}`); 24 | }) 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /google-oauth-passport-js/auth.js: -------------------------------------------------------------------------------- 1 | const passport = require ('passport'); 2 | const GoogleStrategy = require ('passport-google-oauth2').Strategy; 3 | require ('dotenv').config (); 4 | passport.use ( 5 | new GoogleStrategy ( 6 | { 7 | clientID: process.env.GOOGLE_CLIENT_ID, 8 | clientSecret: process.env.GOOGLE_CLIENT_SECRET, 9 | callbackURL: 'http://localhost:5000/auth/google/callback', 10 | passReqToCallback: true, 11 | }, 12 | function (request, accessToken, refreshToken, profile, done) { 13 | done (null, profile); 14 | } 15 | ) 16 | ); 17 | 18 | passport.serializeUser ((user, done) => { 19 | done (null, user); 20 | }); 21 | 22 | passport.deserializeUser ((user, done) => { 23 | done (null, user); 24 | }); 25 | -------------------------------------------------------------------------------- /dodo-app/models/User.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const {Schema} = mongoose; 3 | const bcrypt = require('bcrypt'); 4 | const userSchema = new Schema({ 5 | firstName:String, 6 | lastName:String, 7 | username:{type:String,required:true}, 8 | password:{type:String,required:true} 9 | }); 10 | 11 | 12 | userSchema.pre("save",async function(next){ 13 | const user = this; 14 | if(!user.isModified('password')) return next(); 15 | let salt = await bcrypt.genSalt(10); 16 | let hash = await bcrypt.hash(user.password,salt); 17 | user.password = hash; 18 | next(); 19 | }); 20 | 21 | 22 | userSchema.methods.comparePassword = async function (password){ 23 | return bcrypt.compare(password,this.password); 24 | } 25 | 26 | 27 | 28 | 29 | const User = mongoose.model("User",userSchema); 30 | 31 | 32 | module.exports = User; 33 | 34 | -------------------------------------------------------------------------------- /dodo-app/client/src/services/toDoServices.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import { getUserDetails } from '../util/GetUser'; 3 | 4 | const SERVER_URL = 'http://localhost:5000/api/todo'; 5 | 6 | const authHeaders = ()=>{ 7 | let userToken = getUserDetails()?.token; 8 | return {headers:{'Authorization':userToken}} 9 | 10 | } 11 | 12 | const createToDo = (data)=>{ 13 | return axios.post(SERVER_URL+'/create-to-do',data,authHeaders()); 14 | } 15 | 16 | const getAllToDo = (userId)=>{ 17 | return axios.get(SERVER_URL+'/get-all-to-do/'+userId,authHeaders()); 18 | } 19 | 20 | const deleteToDo = (id)=>{ 21 | return axios.delete(SERVER_URL+'/delete-to-do/'+id,authHeaders()); 22 | } 23 | 24 | const updateToDo = (id,data)=>{ 25 | return axios.patch(SERVER_URL+'/update-to-do/'+id,data,authHeaders()); 26 | } 27 | 28 | 29 | 30 | const ToDoServices = { 31 | createToDo, 32 | getAllToDo, 33 | deleteToDo, 34 | updateToDo 35 | } 36 | 37 | 38 | export default ToDoServices; 39 | 40 | 41 | -------------------------------------------------------------------------------- /dodo-app/client/src/pages/Landing/Landing.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Navbar from '../../components/Navbar' 3 | import { Link } from 'react-router-dom' 4 | import landing from '../../assets/landing.jpg'; 5 | import styles from './Landing.module.css'; 6 | function Landing() { 7 | return ( 8 |
9 | 10 |
11 |
12 |

Schedule Your Daily Tasks With DoDo!

13 |
14 | Register 15 | Login 16 |
17 |
18 | 19 |
20 | landing 21 |
22 |
23 |
24 | ) 25 | } 26 | 27 | export default Landing -------------------------------------------------------------------------------- /todo-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "to-do-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.4", 7 | "@testing-library/react": "^13.3.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "react": "^18.2.0", 10 | "react-dom": "^18.2.0", 11 | "react-icons": "^4.4.0", 12 | "react-scripts": "5.0.1", 13 | "web-vitals": "^2.1.4" 14 | }, 15 | "scripts": { 16 | "start": "react-scripts start", 17 | "build": "react-scripts build", 18 | "test": "react-scripts test", 19 | "eject": "react-scripts eject" 20 | }, 21 | "eslintConfig": { 22 | "extends": [ 23 | "react-app", 24 | "react-app/jest" 25 | ] 26 | }, 27 | "browserslist": { 28 | "production": [ 29 | ">0.2%", 30 | "not dead", 31 | "not op_mini all" 32 | ], 33 | "development": [ 34 | "last 1 chrome version", 35 | "last 1 firefox version", 36 | "last 1 safari version" 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /dodo-app/client/src/pages/Auth/Login.module.css: -------------------------------------------------------------------------------- 1 | .login__card{ 2 | width: 30%; 3 | margin-left: auto; 4 | margin-right: auto; 5 | margin-top: 100px; 6 | box-shadow: 0px 0.344px 12px rgb(238, 238, 238); 7 | padding: 2rem; 8 | border: 1px solid lightgray; 9 | border-radius: 5px; 10 | display: flex; 11 | justify-content: center; 12 | flex-direction: column; 13 | align-items: center; 14 | } 15 | 16 | .login__card h2{ 17 | text-align: center; 18 | font-size: 2rem; 19 | } 20 | 21 | 22 | .input__wrapper,.input__inline__wrapper{ 23 | margin-bottom: 1rem; 24 | width: 80%; 25 | 26 | } 27 | 28 | .input__inline__wrapper{ 29 | display: flex; 30 | justify-content: space-between; 31 | } 32 | 33 | 34 | .login__card img{ 35 | width: 100px; 36 | } 37 | 38 | 39 | .input__info{ 40 | text-align: center; 41 | font-size: 13px; 42 | color:gray; 43 | margin-bottom: 1rem; 44 | } 45 | 46 | .input__info a{ 47 | text-decoration: none; 48 | } 49 | 50 | .input__info a:hover{ 51 | text-decoration: underline; 52 | 53 | } -------------------------------------------------------------------------------- /mern-tutorial/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.5", 7 | "@testing-library/react": "^13.3.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "axios": "^0.27.2", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0", 12 | "react-router": "^6.3.0", 13 | "react-router-dom": "^6.3.0", 14 | "react-scripts": "5.0.1", 15 | "web-vitals": "^2.1.4" 16 | }, 17 | "scripts": { 18 | "start": "react-scripts start", 19 | "build": "react-scripts build", 20 | "test": "react-scripts test", 21 | "eject": "react-scripts eject" 22 | }, 23 | "eslintConfig": { 24 | "extends": [ 25 | "react-app", 26 | "react-app/jest" 27 | ] 28 | }, 29 | "browserslist": { 30 | "production": [ 31 | ">0.2%", 32 | "not dead", 33 | "not op_mini all" 34 | ], 35 | "development": [ 36 | "last 1 chrome version", 37 | "last 1 firefox version", 38 | "last 1 safari version" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /nextjs-intro/public/vercel.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /dodo-app/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@ant-design/icons": "^5.2.6", 7 | "@testing-library/jest-dom": "^5.17.0", 8 | "@testing-library/react": "^13.4.0", 9 | "@testing-library/user-event": "^13.5.0", 10 | "antd": "^5.10.0", 11 | "axios": "^1.5.1", 12 | "react": "^18.2.0", 13 | "react-dom": "^18.2.0", 14 | "react-router": "^6.16.0", 15 | "react-router-dom": "^6.16.0", 16 | "react-scripts": "5.0.1", 17 | "web-vitals": "^2.1.4" 18 | }, 19 | "scripts": { 20 | "start": "react-scripts start", 21 | "build": "react-scripts build", 22 | "test": "react-scripts test", 23 | "eject": "react-scripts eject" 24 | }, 25 | "eslintConfig": { 26 | "extends": [ 27 | "react-app", 28 | "react-app/jest" 29 | ] 30 | }, 31 | "browserslist": { 32 | "production": [ 33 | ">0.2%", 34 | "not dead", 35 | "not op_mini all" 36 | ], 37 | "development": [ 38 | "last 1 chrome version", 39 | "last 1 firefox version", 40 | "last 1 safari version" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/Pages/Blogs.jsx: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import React, { useState,useEffect } from 'react'; 3 | import { Link } from 'react-router-dom'; 4 | 5 | function Blogs () { 6 | const [allBlogs,setAllBlogs] = useState([]); 7 | 8 | useEffect(()=>{ 9 | let isMounted =true; 10 | const getAllBlogs = async ()=>{ 11 | try{ 12 | const response = await axios.get('http://localhost:5000/get-all-blogs'); 13 | // console.log(response); 14 | setAllBlogs(response.data); 15 | }catch(err){ 16 | console.log(err) 17 | } 18 | } 19 | 20 | if(isMounted){ 21 | getAllBlogs(); 22 | } 23 | 24 | return ()=>{ 25 | isMounted = false; 26 | } 27 | 28 | },[]) 29 | 30 | return(<> 31 |

All Blogs

32 | Home 33 |
34 | {allBlogs.map(item=>{ 35 | return( 36 |
37 |

{item.title}

38 | {item.category} 39 |

{item.description}

40 |
41 | ) 42 | })} 43 |
44 | 45 | ); 46 | } 47 | 48 | export default Blogs; 49 | -------------------------------------------------------------------------------- /mern-tutorial/backend/server.js: -------------------------------------------------------------------------------- 1 | const express = require ('express'); 2 | 3 | const app = express (); 4 | const PORT = 5000; 5 | const cors = require ('cors'); 6 | 7 | app.use (cors ()); 8 | 9 | app.use (express.json ()); 10 | app.use (express.urlencoded ({extended: false})); 11 | 12 | const url = 'mongodb://localhost:27017/mongooseBlog'; 13 | 14 | const db = require ('./models'); 15 | const {SingleBlog} = db; 16 | 17 | db.mongoose 18 | .connect (url, {useNewUrlParser: true}) 19 | .then (() => { 20 | console.log (`Connected with mongodb ${url}`); 21 | }) 22 | .catch (err => { 23 | console.log (err); 24 | }); 25 | 26 | app.post ('/create-new-blog', async (req, res) => { 27 | let data = { 28 | title: req.body.title, 29 | description: req.body.description, 30 | category: req.body.category, 31 | }; 32 | 33 | try { 34 | const blog = new SingleBlog (data); 35 | const result = await blog.save (); 36 | console.log (result); 37 | res.send ({message: 'Successfully created Blog!'}); 38 | } catch (err) { 39 | console.log (err); 40 | res.send (err); 41 | } 42 | }); 43 | 44 | app.get ('/get-all-blogs', async (req, res) => { 45 | try { 46 | const result = await SingleBlog.find ({}); 47 | 48 | console.log (result); 49 | res.send (result); 50 | } catch (err) { 51 | console.log (err); 52 | res.send (err); 53 | } 54 | }); 55 | 56 | app.listen (PORT, () => { 57 | console.log (`Server is listening on ${PORT}`); 58 | }); 59 | -------------------------------------------------------------------------------- /dodo-app/client/src/pages/ToDo/ToDoList.module.css: -------------------------------------------------------------------------------- 1 | .toDoWrapper{ 2 | margin-top: 100px; 3 | padding: 2rem; 4 | } 5 | 6 | .toDoHeader{ 7 | display: flex; 8 | align-items:center; 9 | flex-wrap: wrap; 10 | justify-content: space-between; 11 | margin: 0px; 12 | } 13 | 14 | 15 | 16 | .toDoCard{ 17 | border: 1px solid whitesmoke; 18 | box-shadow: 0px 0.233px 8px lightgray; 19 | padding: 1rem; 20 | border-radius: 10px; 21 | width: 25%; 22 | margin: 1rem 1.5rem; 23 | display: flex; 24 | flex-direction: column; 25 | justify-content: space-between; 26 | } 27 | 28 | .toDoCard p{ 29 | font-size: 15px; 30 | color: gray; 31 | margin-top: 1rem; 32 | margin-bottom: 1rem; 33 | } 34 | 35 | .toDoListCardWrapper{ 36 | display: flex; 37 | flex-wrap: wrap; 38 | } 39 | 40 | .toDoCardFooter,.toDoCardHeader{ 41 | display: flex; 42 | justify-content: space-between; 43 | align-items: center; 44 | } 45 | 46 | .toDoCardFooter{ 47 | border-top: 1px solid rgb(236, 235, 235); 48 | padding-top: 10px; 49 | } 50 | 51 | .toDoFooterAction{ 52 | display: flex; 53 | } 54 | 55 | 56 | 57 | .actionIcon{ 58 | font-size: 1.2ren; 59 | margin-left: 5px; 60 | margin-right: 5px; 61 | cursor: pointer; 62 | color: var(--primary); 63 | } 64 | 65 | .actionIcon:hover{ 66 | filter: brightness(50%); 67 | } 68 | 69 | .noTaskWrapper{ 70 | padding: 2rem; 71 | display: flex; 72 | justify-content: center; 73 | align-items: center; 74 | width: 100%; 75 | } -------------------------------------------------------------------------------- /dodo-app/controllers/toDoController.js: -------------------------------------------------------------------------------- 1 | const ToDo = require("../models/ToDoList"); 2 | 3 | 4 | exports.createToDo = async (req,res)=>{ 5 | try{ 6 | const data = req.body; 7 | const todo = new ToDo(data); 8 | const result = await todo.save(); 9 | console.log(result); 10 | res.status(201).send({message:"Created New Task !"}); 11 | 12 | }catch(err){ 13 | console.log(err); 14 | res.status(err); 15 | } 16 | } 17 | 18 | 19 | exports.getAllToDo = async (req,res)=>{ 20 | let {userId} = req.params; 21 | 22 | try{ 23 | const result = await ToDo.find({createdBy:userId}); 24 | res.send(result); 25 | 26 | }catch(err){ 27 | console.log(err); 28 | res.status(400).send(err); 29 | } 30 | 31 | } 32 | 33 | 34 | exports.updateToDo = async (req,res)=>{ 35 | try{ 36 | const {id} = req.params; 37 | const data = req.body; 38 | const result = await ToDo.findByIdAndUpdate(id,{$set:data},{returnOriginal:false}); 39 | console.log(result); 40 | res.send({message:'ToDo list Updated!'}) 41 | }catch(err){ 42 | console.log(err); 43 | res.status(400).send(err); 44 | } 45 | } 46 | 47 | exports.deleteToDo = async (req,res)=>{ 48 | try{ 49 | const {id} = req.params; 50 | const result = await ToDo.findByIdAndDelete(id); 51 | console.log(result); 52 | res.send({message:"ToDo Task Deleted!"}); 53 | }catch(err){ 54 | console.log(err); 55 | res.status(400).send(err); 56 | } 57 | } -------------------------------------------------------------------------------- /google-oauth-passport-js/index.js: -------------------------------------------------------------------------------- 1 | const express = require ('express'); 2 | const passport = require ('passport'); 3 | const session = require ('express-session'); 4 | const path = require ('path'); 5 | const app = express (); 6 | require ('./auth'); 7 | app.use (express.json ()); 8 | app.use (express.static (path.join (__dirname, 'client'))); 9 | 10 | function isLoggedIn (req, res, next) { 11 | req.user ? next () : res.sendStatus (401); 12 | } 13 | 14 | app.get ('/', (req, res) => { 15 | res.sendFile ('index.html'); 16 | }); 17 | 18 | app.use ( 19 | session ({ 20 | secret: 'mysecret', 21 | resave: false, 22 | saveUninitialized: true, 23 | cookie: {secure: false}, 24 | }) 25 | ); 26 | 27 | app.use (passport.initialize ()); 28 | app.use (passport.session ()); 29 | app.get ( 30 | '/auth/google', 31 | passport.authenticate ('google', { 32 | scope: ['email', 'profile'], 33 | }) 34 | ); 35 | 36 | app.get ( 37 | '/auth/google/callback', 38 | passport.authenticate ('google', { 39 | successRedirect: '/auth/protected', 40 | failureRedirect: '/auth/google/failure', 41 | }) 42 | ); 43 | 44 | app.get ('/auth/google/failure', (req, res) => { 45 | res.send ('Something went wrong!'); 46 | }); 47 | 48 | app.get ('/auth/protected', isLoggedIn, (req, res) => { 49 | let name = req.user.displayName; 50 | res.send (`Hello ${name}`); 51 | }); 52 | 53 | app.use ('/auth/logout', (req, res) => { 54 | req.session.destroy (); 55 | res.send ('See you again!'); 56 | }); 57 | 58 | app.listen (5000, () => { 59 | console.log ('Listening on port 5000'); 60 | }); 61 | -------------------------------------------------------------------------------- /nextjs-intro/README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | ``` 12 | 13 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 14 | 15 | You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. 16 | 17 | [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. 18 | 19 | The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. 20 | 21 | ## Learn More 22 | 23 | To learn more about Next.js, take a look at the following resources: 24 | 25 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 26 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 27 | 28 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! 29 | 30 | ## Deploy on Vercel 31 | 32 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 33 | 34 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 35 | -------------------------------------------------------------------------------- /custom-countdown-project/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Counter 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 | 17 | 18 |
19 | 20 |
21 | 22 | 23 |
24 | 25 |
26 |
27 | 28 | 29 | 39 | 40 | 41 | 42 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /todo-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /dodo-app/client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /dodo-app/controllers/authController.js: -------------------------------------------------------------------------------- 1 | const User = require('../models/User'); 2 | const jwt = require('jsonwebtoken'); 3 | require('dotenv').config(); 4 | 5 | const secretKey = process.env.JWT_SECRET; 6 | 7 | async function registerUser(req,res){ 8 | let {firstName,lastName,username,password} = req.body; 9 | try{ 10 | const duplicate = await User.find({username}); 11 | if(duplicate && duplicate.length > 0){ 12 | return res.status(400).send({message:'User already registered with this username'}); 13 | } 14 | let user = new User({firstName,lastName,username,password}); 15 | const result = await user.save(); 16 | console.log(result); 17 | res.status(201).send({message:'User registered successfullY!'}); 18 | }catch(err){ 19 | console.log(err); 20 | res.status(400).send(err); 21 | } 22 | 23 | } 24 | 25 | 26 | async function loginUser(req,res){ 27 | try{ 28 | const {username,password} = req.body; 29 | const user = await User.findOne({username}); 30 | if(!user){ 31 | return res.status(404).send({message:"Authentication Failed!"}); 32 | } 33 | const isPasswordValid = await user.comparePassword(password); 34 | if(!isPasswordValid){ 35 | return res.status(404).send({message:"You Entered Wrong pasword"}); 36 | } 37 | let token = jwt.sign({userId:user?._id},secretKey,{expiresIn:'1h'}); 38 | let finalData = { 39 | userId:user?._id, 40 | username:user?.username, 41 | firstName:user?.firstName, 42 | lastName:user?.lastName, 43 | token 44 | } 45 | res.send(finalData); 46 | }catch(err){ 47 | console.log(err); 48 | res.status(400).send(err) 49 | } 50 | 51 | 52 | } 53 | 54 | 55 | const AuthController = { 56 | registerUser, 57 | loginUser 58 | } 59 | 60 | module.exports = AuthController; -------------------------------------------------------------------------------- /dodo-app/client/src/components/Navbar.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react' 2 | import { Link, useNavigate } from 'react-router-dom' 3 | import logo from '../assets/logo.png'; 4 | import { getUserDetails } from '../util/GetUser'; 5 | import { Dropdown } from 'antd'; 6 | import avatar from '../assets/login.png'; 7 | function Navbar({active}) { 8 | const [user,setUser] = useState(""); 9 | const navigate = useNavigate(); 10 | 11 | useEffect(()=>{ 12 | const userDetails = getUserDetails(); 13 | setUser(userDetails); 14 | },[]); 15 | 16 | const handleLogout = ()=>{ 17 | localStorage.removeItem('toDoAppUser'); 18 | navigate('/login'); 19 | } 20 | 21 | const items = [ 22 | { 23 | key: '1', 24 | label: ( 25 | Logout 26 | ), 27 | }, 28 | 29 | 30 | ]; 31 | 32 | return ( 33 |
34 | 66 |
67 | ) 68 | } 69 | 70 | export default Navbar -------------------------------------------------------------------------------- /custom-countdown-project/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: #4c4177; 3 | background-image: linear-gradient(315deg,#4c4177 0%,#2e5470 74%); 4 | font-family: Arial, Helvetica, sans-serif; 5 | } 6 | 7 | 8 | .form-area,.counter,.complete{ 9 | padding: 20px; 10 | border-radius: 5px; 11 | box-shadow: #1d3647; 12 | background-color: white; 13 | width: fit-content; 14 | margin-left: auto; 15 | margin-right: auto; 16 | margin-top: 10%; 17 | 18 | 19 | } 20 | 21 | .form-area input{ 22 | display: block; 23 | margin: 15px; 24 | padding: 10px; 25 | margin-left: 0px; 26 | margin-right: 0px; 27 | width: 300px; 28 | } 29 | 30 | .form-area{ 31 | font-size: 14px; 32 | font-weight: bold; 33 | } 34 | 35 | button{ 36 | background-color: rgb(0, 110, 255); 37 | width: 100%; 38 | padding: 15px; 39 | border: none; 40 | color: white; 41 | font-weight: bold; 42 | font-size: 16px; 43 | border-radius: 5px; 44 | } 45 | 46 | button:hover{ 47 | background-color: rgb(0, 89, 172); 48 | cursor: pointer; 49 | } 50 | 51 | .counter h1{ 52 | text-align: center; 53 | } 54 | 55 | 56 | li{ 57 | display: inline-block; 58 | font-size: 30px; 59 | list-style-type: none; 60 | padding: 10px; 61 | text-transform: uppercase; 62 | color: rgb(27, 27, 27); 63 | } 64 | 65 | li span{ 66 | display: block; 67 | font-size: 80px; 68 | text-align: center; 69 | 70 | } 71 | 72 | 73 | .complete-title{ 74 | animation: complete 4s infinite; 75 | text-align: center; 76 | } 77 | 78 | 79 | @keyframes complete { 80 | 0%{ 81 | color: red; 82 | } 83 | 84 | 25%{ 85 | color: yellow; 86 | transform: rotate(5deg); 87 | } 88 | 89 | 50%{ 90 | color: green; 91 | transform: scale(1.2) 92 | } 93 | 94 | 75%{ 95 | color: blue; 96 | transform: rotate(-5deg); 97 | } 98 | 99 | 100%{ 100 | color: red; 101 | transform: rotate(0deg); 102 | } 103 | } 104 | 105 | 106 | -------------------------------------------------------------------------------- /dodo-app/client/src/pages/Auth/Login.jsx: -------------------------------------------------------------------------------- 1 | import React,{useState} from 'react' 2 | import styles from './Login.module.css'; 3 | import login from '../../assets/login.png'; 4 | import {Button, Input, message} from 'antd'; 5 | import { Link, useNavigate } from 'react-router-dom'; 6 | import AuthServices from '../../services/authServices'; 7 | import { getErrorMessage } from '../../util/GetError'; 8 | 9 | function Login() { 10 | const [username,setUsername] = useState(""); 11 | const [password,setPassword] = useState(""); 12 | const [loading,setLoading] = useState(false); 13 | const navigate = useNavigate(); 14 | 15 | const handleSubmit = async ()=>{ 16 | 17 | try{ 18 | setLoading(true); 19 | let data = { 20 | username, 21 | password 22 | } 23 | const response = await AuthServices.loginUser(data); 24 | console.log(response.data); 25 | localStorage.setItem('toDoAppUser',JSON.stringify(response.data)); 26 | message.success("Logged in Successfully!"); 27 | navigate('/to-do-list'); 28 | setLoading(false); 29 | }catch(err){ 30 | console.log(err); 31 | message.error(getErrorMessage(err)); 32 | setLoading(false); 33 | } 34 | } 35 | return ( 36 |
37 |
38 | .. 39 |

Login

40 |
41 | setUsername(e.target.value)} /> 45 |
46 |
47 | setPassword(e.target.value)} /> 51 |
52 |
53 | New User? Register 54 |
55 | 56 |
57 |
58 | ) 59 | } 60 | 61 | export default Login -------------------------------------------------------------------------------- /nextjs-intro/styles/Home.module.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 0 2rem; 3 | } 4 | 5 | .main { 6 | min-height: 100vh; 7 | padding: 4rem 0; 8 | flex: 1; 9 | display: flex; 10 | flex-direction: column; 11 | justify-content: center; 12 | align-items: center; 13 | } 14 | 15 | .heading1{ 16 | color:blue; 17 | } 18 | 19 | .footer { 20 | display: flex; 21 | flex: 1; 22 | padding: 2rem 0; 23 | border-top: 1px solid #eaeaea; 24 | justify-content: center; 25 | align-items: center; 26 | } 27 | 28 | .footer a { 29 | display: flex; 30 | justify-content: center; 31 | align-items: center; 32 | flex-grow: 1; 33 | } 34 | 35 | .title a { 36 | color: #0070f3; 37 | text-decoration: none; 38 | } 39 | 40 | .title a:hover, 41 | .title a:focus, 42 | .title a:active { 43 | text-decoration: underline; 44 | } 45 | 46 | .title { 47 | margin: 0; 48 | line-height: 1.15; 49 | font-size: 4rem; 50 | } 51 | 52 | .title, 53 | .description { 54 | text-align: center; 55 | } 56 | 57 | .description { 58 | margin: 4rem 0; 59 | line-height: 1.5; 60 | font-size: 1.5rem; 61 | } 62 | 63 | .code { 64 | background: #fafafa; 65 | border-radius: 5px; 66 | padding: 0.75rem; 67 | font-size: 1.1rem; 68 | font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, 69 | Bitstream Vera Sans Mono, Courier New, monospace; 70 | } 71 | 72 | .grid { 73 | display: flex; 74 | align-items: center; 75 | justify-content: center; 76 | flex-wrap: wrap; 77 | max-width: 800px; 78 | } 79 | 80 | .card { 81 | margin: 1rem; 82 | padding: 1.5rem; 83 | text-align: left; 84 | color: inherit; 85 | text-decoration: none; 86 | border: 1px solid #eaeaea; 87 | border-radius: 10px; 88 | transition: color 0.15s ease, border-color 0.15s ease; 89 | max-width: 300px; 90 | } 91 | 92 | .card:hover, 93 | .card:focus, 94 | .card:active { 95 | color: #0070f3; 96 | border-color: #0070f3; 97 | } 98 | 99 | .card h2 { 100 | margin: 0 0 1rem 0; 101 | font-size: 1.5rem; 102 | } 103 | 104 | .card p { 105 | margin: 0; 106 | font-size: 1.25rem; 107 | line-height: 1.5; 108 | } 109 | 110 | .logo { 111 | height: 1em; 112 | margin-left: 0.5rem; 113 | } 114 | 115 | @media (max-width: 600px) { 116 | .grid { 117 | width: 100%; 118 | flex-direction: column; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /mern-tutorial/frontend/src/Pages/Home.jsx: -------------------------------------------------------------------------------- 1 | import React, {useState} from 'react'; 2 | import './home.css'; 3 | import axios from 'axios'; 4 | import {Link} from 'react-router-dom'; 5 | 6 | function Home () { 7 | const [title, setTitle] = useState (''); 8 | const [category, setCategory] = useState (''); 9 | const [description, setDescription] = useState (''); 10 | 11 | const handleTitle = e => { 12 | // console.log (e.target.value); 13 | setTitle (e.target.value); 14 | }; 15 | 16 | const handleCategoryChange = e => { 17 | setCategory (e.target.value); 18 | }; 19 | 20 | const handleDescriptionChange = e => { 21 | setDescription (e.target.value); 22 | }; 23 | 24 | const handleSubmit = async e => { 25 | e.preventDefault (); 26 | let data = { 27 | title: title, 28 | category: category, 29 | description: description, 30 | }; 31 | // console.log (data); 32 | try { 33 | const response = await axios.post ( 34 | 'http://localhost:5000/create-new-blog', 35 | data 36 | ); 37 | console.log (response); 38 | if (response) { 39 | setTitle (''); 40 | setCategory (''); 41 | setDescription (''); 42 | } 43 | } catch (err) { 44 | console.log (err); 45 | } 46 | }; 47 | 48 | return ( 49 |
50 |

Home

51 | All Blogs 52 |
53 |
54 | 55 | 62 |
63 |
64 | 65 | 72 |
73 |
74 | 75 |