├── .DS_Store
├── .gitignore
├── DoubtClass
├── IIFE
│ └── script.js
└── bind
│ ├── script.js
│ └── spread.js
├── Lecture-1
├── README.md
├── anchor.html
├── htmltags.html
├── index.html
└── list.html
├── Lecture-10
├── 1. datatypes.js
├── 2. objects-Array.js
├── 3. objects-Objects.js
├── 4. ForInLoop.js
├── 5. FloatingPointError.js
├── 6. Strings.js
├── 7. TypeCasting.js
├── 8. Equality.js
├── console.txt
├── index.html
└── script.js
├── Lecture-11
├── 1.functions.js
├── 10.Closures-Advanced.js
├── 2.functions-2.js
├── 3.HigherOrderFunc.js
├── 4.HigherOrderFun.js
├── 5. PassByValAndRef.js
├── 6.Scopes.js
├── 7. Hoisting.js
├── 8.ForEach.js
└── 9.Closures.js
├── Lecture-12
├── 1. Curry.js
├── 2. CirculateReferencing.js
├── 3. ArrayMethods.js
├── 4. AsyncFunction.js
├── 4. AsyncFunctions.html
├── 5. IIFE.js
├── 6. Bindings.html
└── 6. Bindings.js
├── Lecture-13
├── ArrowFunctions
│ ├── arrow.js
│ ├── arrowAndNormal.js
│ └── index.html
├── Bindings
│ ├── this-apply.js
│ ├── this-bind.js
│ ├── this.html
│ ├── this.js
│ ├── thisTest-2.js
│ └── thisTest.js
└── ExecutionContext
│ ├── index.html
│ └── script.js
├── Lecture-14
├── EventLoop
│ ├── async.js
│ └── eventLoop.js
├── MenuFilter
│ ├── menufilter.html
│ ├── script.js
│ └── students.js
└── Prototypes
│ ├── console.txt
│ ├── index.html
│ └── prototypes.js
├── Lecture-15
├── Prototypes
│ ├── CreateObject.js
│ ├── console-1.txt
│ ├── console-2.txt
│ ├── console.txt
│ └── functions.js
├── classes
│ └── script.js
└── newBinding
│ └── script.js
├── Lecture-16
├── Callbacks
│ ├── callback.js
│ ├── details.txt
│ └── scripts.js
└── Promises
│ ├── promise-2.js
│ ├── promise.js
│ ├── promises-1.js
│ ├── script.js
│ └── thenable.js
├── Lecture-17
├── .DS_Store
└── Polyfill
│ ├── bind.js
│ ├── filter.js
│ ├── map.js
│ ├── reduce.js
│ └── script.js
├── Lecture-18
└── Dom
│ ├── console-1.txt
│ ├── console.txt
│ ├── details.txt
│ ├── index.html
│ └── script.js
├── Lecture-19
├── Dom-events
│ ├── index.html
│ └── script.js
└── Dom-manipulation
│ ├── .DS_Store
│ ├── console-1.txt
│ ├── img
│ ├── img1.jpg
│ ├── img2.jpg
│ ├── img3.jpg
│ └── kartik.png
│ ├── index.html
│ ├── project.html
│ ├── script.js
│ └── style.css
├── Lecture-2
├── .DS_Store
├── HTML
│ ├── .DS_Store
│ ├── forms.html
│ ├── images.html
│ ├── img
│ │ ├── img1.jpg
│ │ ├── img2.jpg
│ │ ├── img3.jpg
│ │ └── kartik.png
│ ├── index.html
│ ├── inputs.html
│ └── project.html
└── LearningCSS
│ ├── .DS_Store
│ ├── img
│ ├── img1.jpg
│ ├── img2.jpg
│ ├── img3.jpg
│ └── kartik.png
│ ├── project.html
│ └── style.css
├── Lecture-20
└── 1.Dom-Events
│ ├── index.html
│ ├── script.js
│ ├── script1.js
│ └── style.css
├── Lecture-21
├── Calculator
│ ├── index.html
│ ├── script.js
│ └── style.css
├── DOM-Events
│ ├── index.html
│ ├── script.js
│ └── style.css
├── Event-Cycle(CTB)
│ ├── index.html
│ ├── script.js
│ └── style.css
└── Event-Delegation
│ ├── console.txt
│ ├── index.html
│ ├── script.js
│ └── style.css
├── Lecture-22
├── 1.JqueryBasics
│ ├── chaining.js
│ ├── console.txt
│ ├── index.html
│ ├── script.js
│ └── style.css
├── 2.TodoList
│ ├── index.html
│ ├── script.js
│ └── style.css
└── 3.DOM-Working
│ ├── index.html
│ └── script.js
├── Lecture-23
├── 1. Json
│ ├── script-1.js
│ └── script.js
├── 2. Api
│ ├── another.js
│ ├── index.html
│ └── script.js
├── 3. MovieApp
│ ├── index.html
│ ├── script.js
│ └── style.css
└── 4. Geolocation
│ ├── index.html
│ └── script.js
├── Lecture-24(NODEJS)
├── 1. Modules
│ ├── lib1.js
│ └── main.js
├── 2.FileDependency
│ ├── lib1.js
│ ├── lib2.js
│ └── main.js
├── 3.File handling
│ ├── SortNumbersQuestion
│ │ ├── input1.txt
│ │ ├── input2.txt
│ │ ├── out.txt
│ │ └── script.js
│ ├── myFiles
│ │ └── hello.txt
│ ├── path.js
│ ├── readFile.js
│ └── writeFile.js
├── NodeJsBasics
│ └── 1. ObjectFunctionalities.js
└── notes.md
├── Lecture-25(AnimationProject)
├── css
│ ├── animation.css
│ └── style.css
├── images
│ ├── Cody.png
│ ├── Space.png
│ └── rocket.png
└── index.html
├── Lecture-26(ExpressJS)
├── 1.ExpressBasics
│ ├── .gitignore
│ ├── 1.script.js
│ ├── package-lock.json
│ └── package.json
└── 2.ExpressFiles
│ ├── script.js
│ └── static
│ ├── app.js
│ ├── index.html
│ └── lib.js
├── Lecture-27(ExpressJS)
├── 1.API
│ ├── .gitignore
│ ├── package-lock.json
│ ├── package.json
│ ├── script.js
│ └── static
│ │ ├── index.html
│ │ └── js
│ │ └── app.js
└── 2.Todo-API
│ ├── .gitignore
│ ├── package-lock.json
│ ├── package.json
│ ├── script.js
│ ├── static
│ ├── index.html
│ └── script.js
│ └── tasks.txt
├── Lecture-28(Templates)
├── .gitignore
├── TodoList
│ ├── app.js
│ ├── mytasks.txt
│ ├── package-lock.json
│ ├── package.json
│ └── views
│ │ └── index.hbs
├── app.js
├── package-lock.json
├── package.json
└── views
│ └── index.hbs
├── Lecture-29
├── .DS_Store
├── 1.Routers
│ ├── .gitignore
│ ├── app.js
│ ├── package-lock.json
│ ├── package.json
│ └── routers
│ │ ├── students.js
│ │ └── teachers.js
├── 2.Middlewares
│ ├── .gitignore
│ ├── example.js
│ ├── package-lock.json
│ ├── package.json
│ └── script.js
└── 3.AdminAndUserPortal
│ ├── .gitignore
│ ├── app.js
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ └── index.html
│ ├── routers
│ ├── admin.js
│ └── user.js
│ └── views
│ ├── admin.hbs
│ └── user.hbs
├── Lecture-3
├── .DS_Store
└── LearningCSS
│ ├── .DS_Store
│ ├── code
│ ├── project-1.html
│ └── style-1.css
│ ├── img
│ ├── img1.jpg
│ ├── img2.jpg
│ ├── img3.jpg
│ └── kartik.png
│ ├── project.html
│ └── style.css
├── Lecture-30(MVC)
├── .gitignore
├── app.js
├── controllers
│ ├── admin.js
│ └── shop.js
├── data
│ └── product.json
├── index.html
├── models
│ └── product.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ └── form.css
│ └── garbage.txt
├── routes
│ ├── admin.js
│ └── shop.js
└── views
│ ├── admin
│ └── product-list.hbs
│ └── shop
│ └── shop.hbs
├── Lecture-31(ShoppingCart)
├── .DS_Store
├── .gitignore
├── app.js
├── controllers
│ ├── admin.js
│ └── shop.js
├── data
│ ├── cart.json
│ └── product.json
├── index.html
├── models
│ ├── cart.js
│ └── product.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ ├── form.css
│ │ └── style.css
│ └── garbage.txt
├── routes
│ ├── admin.js
│ └── shop.js
└── views
│ ├── .DS_Store
│ ├── admin
│ ├── add-product.hbs
│ ├── edit-product.hbs
│ └── product-list.hbs
│ ├── partials
│ └── navbar.hbs
│ └── shop
│ ├── cart.hbs
│ └── shop.hbs
├── Lecture-32(MySQL)
├── .DS_Store
├── .gitignore
├── ShoppingCart-Sequelize
│ ├── .DS_Store
│ ├── app.js
│ ├── controllers
│ │ ├── admin.js
│ │ └── shop.js
│ ├── data
│ │ ├── cart.json
│ │ └── product.json
│ ├── index.html
│ ├── models
│ │ ├── cart.js
│ │ └── product.js
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── css
│ │ │ ├── form.css
│ │ │ └── style.css
│ │ └── garbage.txt
│ ├── routes
│ │ ├── admin.js
│ │ └── shop.js
│ ├── util
│ │ └── database.js
│ └── views
│ │ ├── .DS_Store
│ │ ├── admin
│ │ ├── add-product.hbs
│ │ ├── edit-product.hbs
│ │ └── product-list.hbs
│ │ ├── partials
│ │ └── navbar.hbs
│ │ └── shop
│ │ ├── cart.hbs
│ │ └── shop.hbs
├── app.js
├── controllers
│ ├── admin.js
│ └── shop.js
├── data
│ ├── cart.json
│ └── product.json
├── index.html
├── models
│ ├── cart.js
│ └── product.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ ├── form.css
│ │ └── style.css
│ └── garbage.txt
├── routes
│ ├── admin.js
│ └── shop.js
├── util
│ └── database.js
└── views
│ ├── .DS_Store
│ ├── admin
│ ├── add-product.hbs
│ ├── edit-product.hbs
│ └── product-list.hbs
│ ├── partials
│ └── navbar.hbs
│ └── shop
│ ├── cart.hbs
│ └── shop.hbs
├── Lecture-33(Sequelize)
├── .DS_Store
├── .gitignore
├── app.js
├── controllers
│ ├── admin.js
│ └── shop.js
├── data
│ ├── cart.json
│ └── product.json
├── index.html
├── models
│ ├── cart.js
│ └── product.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ ├── form.css
│ │ └── style.css
│ └── garbage.txt
├── routes
│ ├── admin.js
│ └── shop.js
├── util
│ └── database.js
└── views
│ ├── .DS_Store
│ ├── admin
│ ├── add-product.hbs
│ ├── edit-product.hbs
│ └── product-list.hbs
│ ├── partials
│ └── navbar.hbs
│ └── shop
│ ├── cart.hbs
│ └── shop.hbs
├── Lecture-34(RevisionProject)
├── .gitignore
├── app.js
├── controller
│ ├── admin.js
│ └── shop.js
├── data-deleted
│ └── products-deleted.js
├── model
│ └── product.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ └── style.css
│ └── random.txt
├── routes
│ ├── admin.js
│ └── shop.js
├── util
│ └── database.js
└── views
│ ├── admin
│ ├── add-product.hbs
│ ├── edit-product.hbs
│ └── product-list.hbs
│ ├── partials
│ ├── add-product-form.hbs
│ ├── edit-product-form.hbs
│ └── navbar.hbs
│ └── shop
│ └── shop.hbs
├── Lecture-35(Revision-Sequelize)
├── .gitignore
├── app.js
├── controller
│ ├── admin.js
│ └── shop.js
├── model
│ ├── product.js
│ └── user.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ └── style.css
│ └── random.txt
├── routes
│ ├── admin.js
│ └── shop.js
├── util
│ └── database.js
└── views
│ ├── admin
│ ├── add-product.hbs
│ ├── edit-product.hbs
│ └── product-list.hbs
│ ├── partials
│ ├── add-product-form.hbs
│ ├── edit-product-form.hbs
│ └── navbar.hbs
│ └── shop
│ └── shop.hbs
├── Lecture-36(Revision-Sequelize-2)
├── .gitignore
├── app.js
├── controller
│ ├── admin.js
│ └── shop.js
├── model
│ ├── cart-item.js
│ ├── cart.js
│ ├── product.js
│ └── user.js
├── package-lock.json
├── package.json
├── public
│ ├── css
│ │ └── style.css
│ └── random.txt
├── routes
│ ├── admin.js
│ └── shop.js
├── util
│ └── database.js
└── views
│ ├── admin
│ ├── add-product.hbs
│ ├── edit-product.hbs
│ └── product-list.hbs
│ ├── partials
│ ├── add-product-form.hbs
│ ├── edit-product-form.hbs
│ └── navbar.hbs
│ └── shop
│ ├── cart.hbs
│ └── shop.hbs
├── Lecture-37(MongoDB)
├── .gitignore
├── delete.js
├── package-lock.json
├── package.json
├── read.js
└── write.js
├── Lecture-38(Sockets)
├── .gitignore
├── package-lock.json
├── package.json
├── server.js
└── static
│ ├── index.html
│ └── script.js
├── Lecture-39(Cookies)
├── .DS_Store
├── Cookies
│ ├── app.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ │ ├── login.js
│ │ └── profile.js
│ └── views
│ │ ├── login.hbs
│ │ └── profile.hbs
└── Sessions
│ ├── .gitignore
│ ├── app.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── login.js
│ └── profile.js
│ └── views
│ ├── login.hbs
│ └── profile.hbs
├── Lecture-4
├── .DS_Store
└── LearningCSS
│ ├── .DS_Store
│ ├── display.html
│ ├── flexboxes.html
│ ├── img
│ ├── img1.jpg
│ ├── img2.jpg
│ ├── img3.jpg
│ └── kartik.png
│ ├── notes.txt
│ ├── project.html
│ └── style.css
├── Lecture-40(Passport)
├── app.js
├── data
│ ├── WiredTiger
│ ├── WiredTiger.lock
│ ├── WiredTiger.turtle
│ ├── WiredTiger.wt
│ ├── WiredTigerHS.wt
│ ├── _mdb_catalog.wt
│ ├── collection-0--6943186233444725672.wt
│ ├── collection-10--6943186233444725672.wt
│ ├── collection-12--6943186233444725672.wt
│ ├── collection-15--6943186233444725672.wt
│ ├── collection-16--6943186233444725672.wt
│ ├── collection-2--6943186233444725672.wt
│ ├── collection-20--6943186233444725672.wt
│ ├── collection-23--6943186233444725672.wt
│ ├── collection-4--6943186233444725672.wt
│ ├── collection-7--6943186233444725672.wt
│ ├── diagnostic.data
│ │ └── metrics.2022-11-19T09-06-29Z-00000
│ ├── index-1--6943186233444725672.wt
│ ├── index-11--6943186233444725672.wt
│ ├── index-13--6943186233444725672.wt
│ ├── index-14--6943186233444725672.wt
│ ├── index-17--6943186233444725672.wt
│ ├── index-18--6943186233444725672.wt
│ ├── index-19--6943186233444725672.wt
│ ├── index-21--6943186233444725672.wt
│ ├── index-22--6943186233444725672.wt
│ ├── index-24--6943186233444725672.wt
│ ├── index-3--6943186233444725672.wt
│ ├── index-5--6943186233444725672.wt
│ ├── index-6--6943186233444725672.wt
│ ├── index-8--6943186233444725672.wt
│ ├── index-9--6943186233444725672.wt
│ ├── journal
│ │ ├── WiredTigerLog.0000000001
│ │ ├── WiredTigerPreplog.0000000001
│ │ └── WiredTigerPreplog.0000000002
│ ├── mongod.lock
│ ├── sizeStorer.wt
│ └── storage.bson
├── database.js
├── package-lock.json
├── package.json
├── passport.js
├── routes
│ └── routes.js
├── test.html
└── views
│ ├── login.hbs
│ ├── profile.hbs
│ └── signup.hbs
├── Lecture-41(ReactJS)
└── learn-react
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── components
│ ├── JsxLearn.js
│ ├── Person.css
│ ├── Person.js
│ └── Todolist.js
│ ├── index.css
│ └── index.js
├── Lecture-42(ReactJS)
└── forms-demo
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── Navbar.js
│ ├── Person.css
│ ├── Person.js
│ ├── components
│ ├── Counter.js
│ ├── Form.css
│ ├── Form.js
│ ├── Product.css
│ ├── Product.js
│ ├── ShoppingList.css
│ └── ShoppingList.js
│ ├── index.css
│ └── index.js
├── Lecture-43(ReactJS)
├── .DS_Store
└── hooks
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── components
│ ├── PlayList.js
│ └── Toggle.js
│ ├── hooks
│ └── useToggle.js
│ ├── index.css
│ └── index.js
├── Lecture-44-ReactJS
└── todoapp
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── components
│ ├── Form
│ │ ├── Form.js
│ │ └── Form.module.css
│ ├── Todo
│ │ ├── Todo.js
│ │ └── Todo.module.css
│ ├── TodoApp
│ │ ├── TodoApp.js
│ │ └── TodoApp.module.css
│ └── TodoList
│ │ ├── TodoList.js
│ │ └── TodoList.module.css
│ ├── index.css
│ └── index.js
├── Lecture-45(ReactJS)
├── myapp
│ ├── backend
│ │ ├── apis
│ │ │ └── foodapi.js
│ │ ├── app.js
│ │ ├── model
│ │ │ └── db.js
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ └── seed.js
│ └── frontend
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ │ └── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── components
│ │ ├── Food.js
│ │ └── FoodList.js
│ │ ├── index.css
│ │ └── index.js
└── router-demo
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── components
│ ├── About.js
│ ├── Courses.js
│ └── Home.js
│ ├── index.css
│ └── index.js
├── Lecture-46(TestingFramework)
├── Tests
│ ├── app_test.js
│ └── fare_test.js
├── app.js
├── fare.js
├── package-lock.json
└── package.json
├── Lecture-5
├── .DS_Store
├── GridLayout
│ ├── index.html
│ └── style.css
└── Transforms
│ ├── 3dTransform.html
│ ├── img
│ ├── img.jpeg
│ └── kartik.jpg
│ └── index.html
├── Lecture-6
├── .DS_Store
├── HoverList
│ └── index.html
├── Positions
│ ├── absolute.html
│ ├── fixed.html
│ └── sticky.html
├── TeamCards
│ ├── img
│ │ ├── img.jpeg
│ │ └── kartik.jpg
│ ├── style.css
│ └── team.html
└── mediaQueries
│ ├── .DS_Store
│ ├── img
│ ├── img.jpeg
│ └── kartik.jpg
│ ├── style.css
│ └── team.html
├── Lecture-7
├── .DS_Store
├── Animations
│ ├── index.html
│ └── style.css
└── Bootstrap
│ ├── .DS_Store
│ ├── Final-Project.html
│ ├── Image
│ ├── Comiccon.jpg
│ ├── Jason.jpg
│ ├── Mark.jpg
│ ├── Michael.jpg
│ ├── Nidhi.jpg
│ ├── Ryan.jpg
│ └── Sergio.jpg
│ ├── index.html
│ ├── project.html
│ └── style.css
├── Lecture-8-Git
└── file1.txt
├── Lecture-9
└── index.html
└── README.md
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/DoubtClass/bind/spread.js:
--------------------------------------------------------------------------------
1 | function fun(x,y,z){
2 | console.log(x);
3 | console.log(y);
4 | console.log(z);
5 | }
6 |
7 | fun(...[1,2,3]);
8 |
--------------------------------------------------------------------------------
/Lecture-1/README.md:
--------------------------------------------------------------------------------
1 | # WebDev19Jun2022
2 |
--------------------------------------------------------------------------------
/Lecture-1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | First Web Page
4 |
5 |
6 |
7 | Heading 1
8 | Heading 2
9 | Heading 3
10 | Heading 4
11 | Heading 5
12 | Heading 6
13 | AnchorPage
14 | SecondPara-AnchorPage
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Lecture-10/1. datatypes.js:
--------------------------------------------------------------------------------
1 | // NUMBER
2 | let a = 10;
3 | console.log(typeof a);
4 |
5 | let b = 10.11;
6 | console.log(typeof b);
7 |
8 | // STRING
9 | let str = '';
10 | let str1 = 'A';
11 | let str2 = 'Hello World!';
12 | let str3 = "Hello World!";
13 |
14 | console.log(typeof str);
15 | console.log(typeof str1);
16 | console.log(typeof str2);
17 | console.log(typeof str3);
18 |
19 | // BOOLEAN
20 | let c = true;
21 | let d = false;
22 | console.log(typeof c);
23 | console.log(typeof d);
24 |
25 | // UNDEFINED
26 | let e = undefined;
27 | console.log(typeof e);
28 |
29 | // Object
30 | let f = null;
31 | console.log(typeof f);
32 |
33 | // FUNCTIONS: Baad mei dekhenge issi class mei
--------------------------------------------------------------------------------
/Lecture-10/2. objects-Array.js:
--------------------------------------------------------------------------------
1 | // Array
2 | let a = [1,2,3,4];
3 | console.log(typeof a);
4 | // console.log(a[0]);
5 | // console.log(a[1]);
6 | // console.log(a[2]);
7 | // console.log(a[3]);
8 | a[8] = 1.11;
9 | a[9] = true;
10 | a[10] = 'Hello';
11 |
12 | let str = '';
13 | for(let i = 0; i < a.length ; i++){
14 | console.log(a[i]);
15 | str += a[i] + ' ';
16 | }
17 | console.log(a);
18 |
19 | // console.log('Printing using while: ');
20 | // let j = 0;
21 | // while(j
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Lecture-10/script.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const a = 10;
4 | console.log(a);
5 |
6 | let b = "Hello"; // By default var create hota hai
7 | console.log(b);
8 |
9 | var c = true;
10 | console.log(c);
--------------------------------------------------------------------------------
/Lecture-11/1.functions.js:
--------------------------------------------------------------------------------
1 | function add(a,b){
2 | return a+b;
3 | }
4 |
5 | let x = add(10,15);
6 | console.log(x);
7 |
8 | function subtract(a,b){
9 | return a-b;
10 | }
11 |
12 | let y = subtract(10,5);
13 | console.log(y);
14 |
15 | function printHello(){
16 | console.log("Hello World!");
17 | }
18 |
19 | printHello();
20 |
21 | // DEFAULT ARGUMENTS
22 | function add1(a = 10,b = 20){
23 | return a+b;
24 | }
25 |
26 | let ans = add1();
27 | console.log(ans);
28 | console.log(add1(20,20));
29 | console.log(add1());
30 |
31 | console.log(typeof add);
32 | console.log(typeof add1);
33 | console.log(typeof subtract);
--------------------------------------------------------------------------------
/Lecture-11/10.Closures-Advanced.js:
--------------------------------------------------------------------------------
1 | function FunGen(){
2 | let x = 0;
3 | function newFun(){
4 | x++;
5 | function newerFun(){
6 | x++;
7 | return x;
8 | }
9 | return newerFun;
10 | }
11 | return newFun;
12 | }
13 | let fun1 = FunGen(); // Yeh function return kar raha hai
14 | let fun2 = FunGen(); // Yeh function return kar raha hai
15 | let fun11 = fun1(); // Yeh function return kar raha hai
16 | let fun12 = fun1(); // Yeh function return kar raha hai
17 |
18 | console.log(fun11()); // 2 3 2
19 | console.log(fun11()); // 4 4 3
20 | console.log(fun12()); // 2 3 2
21 | console.log(fun12()); // 4 4 3
22 | console.log(fun11()); // 6 5 4
23 |
24 |
--------------------------------------------------------------------------------
/Lecture-11/2.functions-2.js:
--------------------------------------------------------------------------------
1 | var add = function(a,b){
2 | return a+b;
3 | }
4 |
5 | let subtract = function(a,b){
6 | return a-b;
7 | }
8 |
9 | console.log(add(2,10));
10 | console.log(subtract(20,10));
--------------------------------------------------------------------------------
/Lecture-11/3.HigherOrderFunc.js:
--------------------------------------------------------------------------------
1 | function funGen(fun){
2 | // this will print the statement telling us this is JS function
3 | console.log(fun);
4 |
5 | // To print function as a string
6 | console.log(fun.toString());
7 | console.log(""+fun);
8 |
9 | console.log("Inside function generator " + fun());
10 |
11 | }
12 |
13 | function anotherFun(){
14 | console.log("Inside another fun");
15 | }
16 |
17 | // We have passed one function as an argument
18 | funGen(anotherFun);
19 |
20 | // funGen(10);
21 | // funGen("Hello World!");
22 | // anotherFun();
23 |
24 |
--------------------------------------------------------------------------------
/Lecture-11/4.HigherOrderFun.js:
--------------------------------------------------------------------------------
1 | function outerFun(){
2 | console.log("Inside OuterFun");
3 | function innerFun(){
4 | console.log("Inside anotherFun");
5 | }
6 | return innerFun;
7 | }
8 |
9 | let y = outerFun();
10 | console.log(y());
11 | console.log(y());
--------------------------------------------------------------------------------
/Lecture-11/5. PassByValAndRef.js:
--------------------------------------------------------------------------------
1 | /*
2 | function update(a,b,c){
3 | c = a+b;
4 | console.log("Inside update c: "+c);
5 | }
6 |
7 |
8 | let a = 10,b=20,c;
9 | update(a,b,c);
10 | console.log(c);
11 | */
12 |
13 | // To actually update the value
14 | function update(a,b,c){
15 | c = a+b;
16 | // console.log("Inside update c: "+c);
17 | return c;
18 | }
19 |
20 |
21 | let a = 10,b=20,c;
22 | c = update(a,b,c);
23 | console.log(c);
24 |
25 | // PASS BY REFERENCE
26 | let arr = [1,2,3,4];
27 | console.log(arr == [1,2,3,4]); // false, because memory references are different
28 |
29 | let arr1 = [1,2,3,4];
30 | console.log(arr == arr1); // false
31 |
32 | let arr2 = arr;
33 | console.log(arr2 == arr); // true
34 |
35 | function update1(arr){
36 | arr[2] = arr[1]+arr[2];
37 | }
38 |
39 | let x = [1,2,5];
40 | console.log(x);
41 | update1(x);
42 | console.log(x);
--------------------------------------------------------------------------------
/Lecture-11/7. Hoisting.js:
--------------------------------------------------------------------------------
1 | hello();
2 |
3 | function hello(){
4 | console.log("Hello World!");
5 | }
6 |
7 | var x = 20;
8 | console.log(x);
9 |
10 | console.log(add(10,20));
11 |
12 | var add = function(a,b){
13 | return a+b;
14 | }
15 |
--------------------------------------------------------------------------------
/Lecture-11/8.ForEach.js:
--------------------------------------------------------------------------------
1 | let arr = [1,2,3,4,5,6];
2 |
3 | let sum = 0;
4 | arr.forEach(myFun);
5 |
6 | function myFun(value,indx,arr){
7 | console.log(value);
8 | sum+= value;
9 | }
10 | console.log("Sum: " + sum);
11 |
12 | arr.forEach(function(value,indx,arr){
13 | console.log(value);
14 | });
15 |
16 | arr.forEach(function(value,indx){
17 | console.log("Index: "+indx+" Value: "+value);
18 | });
19 |
20 |
--------------------------------------------------------------------------------
/Lecture-11/9.Closures.js:
--------------------------------------------------------------------------------
1 | function FunGen(){
2 | let x = 0;
3 | function newFun(){
4 | x++;
5 | return x;
6 | }
7 |
8 | return newFun;
9 | }
10 |
11 | let fun1 = FunGen();
12 | let fun2 = FunGen();
13 | console.log(fun1()); // 1
14 | console.log(fun1()); // 2
15 | console.log(fun1()); // 3
16 |
17 | console.log(fun2()); // 1
18 | console.log(fun2()); // 2
19 |
--------------------------------------------------------------------------------
/Lecture-12/1. Curry.js:
--------------------------------------------------------------------------------
1 | function add(val){
2 | if(typeof val == 'undefined') return 0;
3 |
4 | function addVal(nextVal){
5 | if(typeof nextVal == 'undefined') return val;
6 | val+=nextVal;
7 | return addVal;
8 | }
9 |
10 | return addVal;
11 | }
12 |
13 | console.log(add(1)());
14 | console.log(add(1)(2)());
15 | console.log(add(1)(2)(3)());
16 | console.log(add(1)(2)(3)(4)());
17 | console.log(add(1)(2)(3)(4)(5)());
--------------------------------------------------------------------------------
/Lecture-12/2. CirculateReferencing.js:
--------------------------------------------------------------------------------
1 | let o = {
2 | a: 'Hello'
3 | };
4 |
5 | o.b = 'World';
6 | o.o = o;
7 | console.log(o);
8 | console.log(o.o);
9 | console.log(o.o.o);
10 | // console.log(o.o.o.o.o.o.o == o);
11 | // console.log(o.o.o.o.o.o.o.o.o.o.o.o.o == o);
12 | // console.log(o);
--------------------------------------------------------------------------------
/Lecture-12/4. AsyncFunctions.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Lecture-12/5. IIFE.js:
--------------------------------------------------------------------------------
1 | function add(a,b){
2 | return a+b;
3 | }
4 |
5 | console.log(add(10,20));
6 |
7 | (function IIFE(a,b){
8 | console.log('Running inside Function-IIFE '+a*b);
9 | })(10,20);
10 |
11 | // USECASES
12 | // 1. Minification
13 | (function(l,s,si,p){
14 | l(`3^4: ${p(3,4)}`);
15 | l(`4^3: ${p(4,3)}`);
16 | l(`Sin(45): ${si(45)}`);
17 | l(`Sqrt(25): ${s(25)}`);
18 | })(console.log,Math.sqrt,Math.sin,Math.pow);
19 |
20 | var student = (function IIFE(name){
21 | let marks = 30;
22 | function student(){
23 | details();
24 | }
25 |
26 | function details(){
27 | console.log('Name: '+name+ ', Percentage: '+ (marks/50)*100);
28 | }
29 | return student;
30 | })('Rishabh');
31 |
32 | student();
33 | console.log(student.toString());
--------------------------------------------------------------------------------
/Lecture-12/6. Bindings.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Lecture-12/6. Bindings.js:
--------------------------------------------------------------------------------
1 | // 1. Implicit Binding
2 | /*
3 | console.log(this);
4 | function add(a,b){
5 | console.log(this);
6 | console.log(a+b);
7 | }
8 | add(10,20);
9 | */
10 |
11 | // 2. Explicit Binding
12 |
13 | let obj = {
14 | a: 'Hello',
15 | f: this
16 | };
17 |
18 | console.log(obj.f);
19 | console.log(this);
20 |
21 |
22 | obj = {
23 | a: 'Hello',
24 | fun: function(){
25 | console.log(this);
26 | return this;
27 | }
28 | }
29 |
30 | console.log(obj.fun());
--------------------------------------------------------------------------------
/Lecture-13/ArrowFunctions/arrowAndNormal.js:
--------------------------------------------------------------------------------
1 | let obj = {
2 | name:'Kartik',
3 | fun: ()=>{
4 | console.log(this);
5 | }
6 | }
7 |
8 | let obj1 = {
9 | name: "Coding Blocks",
10 | fun: function () {
11 | console.log(this);
12 | }
13 | }
14 |
15 | console.log(obj);
16 | console.log(obj1);
17 | obj1.fun();
18 | obj.fun();
--------------------------------------------------------------------------------
/Lecture-13/ArrowFunctions/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Lecture-13/Bindings/this-apply.js:
--------------------------------------------------------------------------------
1 | function Fun(company,town){
2 | console.log(this);
3 | console.log("Inside Fun this points to " + this + " "+company+" "+town);
4 | }
5 | Fun();
6 |
7 | obj = {
8 | firstName: 'Kartik',
9 | fun: function(){
10 | console.log(this);
11 | this.lastName = "Mathur";
12 | return this;
13 | }
14 | }
15 |
16 |
17 | Fun.apply(obj,["Coding Blocks","Kohat Enclave"]);
18 |
--------------------------------------------------------------------------------
/Lecture-13/Bindings/this-bind.js:
--------------------------------------------------------------------------------
1 | function Fun(company,town){
2 | console.log(this);
3 | console.log("Inside Fun this points to " + this + " "+company+" "+town);
4 | }
5 | Fun();
6 |
7 | obj = {
8 | firstName: 'Kartik',
9 | fun: function(){
10 | console.log(this);
11 | this.lastName = "Mathur";
12 | return this;
13 | }
14 | }
15 |
16 | let funCall = Fun.bind(obj);
17 | funCall("Coding Blocks","Kohat");
--------------------------------------------------------------------------------
/Lecture-13/Bindings/this.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Lecture-13/Bindings/thisTest-2.js:
--------------------------------------------------------------------------------
1 | function solve(company,place) {
2 | console.log(this);
3 | console.log(company + place);
4 | }
5 |
6 | let movie = {
7 | name:"3-Idiots",
8 | actor: ["Amir khan","kareena kapoor"]
9 | };
10 |
11 | solve();
12 | solve.call(movie);
13 | solve.apply(movie,["CB","Kohat"]);
14 |
15 | let solveFun = solve.bind(movie);
16 | solveFun();
--------------------------------------------------------------------------------
/Lecture-13/Bindings/thisTest.js:
--------------------------------------------------------------------------------
1 | function solve() {
2 | console.log(this);
3 | }
4 |
5 | let arr = [1,2,3,4,"Hello"];
6 |
7 | let movie = {
8 | name:"3-Idiots",
9 | actor: ["Amir khan","kareena kapoor"]
10 | };
11 |
12 | solve();
13 | solve.call(arr);
14 | solve.call(movie);
15 |
16 |
17 | let obj = {
18 | a: 'hello',
19 | fun: this
20 | };
21 |
22 | console.log(obj.fun); // Window
23 |
24 | let obj1 = {
25 | a: 'world',
26 | b: function(){
27 | console.log(this);
28 | }
29 | };
30 |
31 | obj1.b(); // obj1
--------------------------------------------------------------------------------
/Lecture-13/ExecutionContext/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Lecture-13/ExecutionContext/script.js:
--------------------------------------------------------------------------------
1 | let y = 10;
2 | function GenFun(){
3 | var a = 10;
4 | function Fun(){
5 | return a**2;
6 | }
7 | return Fun;
8 | }
9 |
10 | let x = GenFun();
11 | console.log(x());
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Lecture-14/EventLoop/async.js:
--------------------------------------------------------------------------------
1 | console.log('...downloading starts');
2 |
3 | setTimeout(()=>{
4 | console.log('..downloading ends');
5 | },3000);
6 |
7 | let x = 10;
8 | let y = 'Hello';
9 | console.log(x);
10 | console.log(y);
--------------------------------------------------------------------------------
/Lecture-14/EventLoop/eventLoop.js:
--------------------------------------------------------------------------------
1 | let a = 10;
2 |
3 | function Fun(){
4 | console.log("Function Fun is running");
5 | }
6 | Fun();
7 |
8 | setTimeout(function timeout() {
9 | console.log("Click the button!");
10 | }, 5000);
11 |
12 | console.log("Welcome to loupe.");
13 | console.log(a);
14 | console.log("Hello World!");
15 |
--------------------------------------------------------------------------------
/Lecture-14/MenuFilter/menufilter.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Lecture-14/Prototypes/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Lecture-14/Prototypes/prototypes.js:
--------------------------------------------------------------------------------
1 | // dunder proto: __proto__
2 | function fun(){
3 | console.log('Fun');
4 | }
5 |
6 | fun();
7 | console.log(fun.__proto__);
8 | console.log(fun.__proto__ == Function.prototype);
9 |
--------------------------------------------------------------------------------
/Lecture-15/Prototypes/console-1.txt:
--------------------------------------------------------------------------------
1 | arr.pop()
2 | 4
3 | arr
4 | (3) [1, 2, 3]
5 | arr.pop = ()=>{console.log("Nahi krne dunga");}
6 | ()=>{console.log("Nahi krne dunga");}
7 | arr.pop()
8 | VM2997:1 Nahi krne dunga
9 | undefined
10 | arr
11 | (3) [1, 2, 3, pop: ƒ]
--------------------------------------------------------------------------------
/Lecture-15/Prototypes/console.txt:
--------------------------------------------------------------------------------
1 | let a = 1;
2 | undefined
3 | a.__proto__ == Number.prototype
4 | true
5 | let str = 'Hello';
6 | undefined
7 | str.__proto__ == String.prototype
8 | true
9 | let x = true;
10 | undefined
11 | x.__proto__ == Boolean.prototype
12 | true
13 | String.prototype
14 | String {'', constructor: ƒ, anchor: ƒ, at: ƒ, big: ƒ, …}
15 | String
16 | ƒ String() { [native code] }
17 | Function.prototype
18 | ƒ () { [native code] }
19 | function fun(){console.log('hello');}
20 | undefined
21 | fun.toString() // Kaha se chala? Meine to nhi banaya na hi Function.prototype mei available hai toString()
22 | "function fun(){console.log('hello');}"
23 | fun.__proto__ == Function.prototype
24 | true
25 | arr.__proto__ == Array.prototype
26 | true
27 | arr.toString()
28 | '1,2,3,4'
29 | Array.prototype
30 | [constructor: ƒ, at: ƒ, concat: ƒ, copyWithin: ƒ, fill: ƒ, …]
--------------------------------------------------------------------------------
/Lecture-15/Prototypes/functions.js:
--------------------------------------------------------------------------------
1 | function fun(){
2 | console.log('Bhot saara hai fun');
3 | }
4 |
5 | fun();
6 | fun.a = 10;
7 | console.log(fun);
8 | fun();
9 | console.log(fun.a);
10 | console.log(typeof fun);
--------------------------------------------------------------------------------
/Lecture-16/Callbacks/callback.js:
--------------------------------------------------------------------------------
1 | function chopping(vegetables,sabziBanna){
2 | console.log('...chopping karna start of '+vegetables);
3 | setTimeout(()=>{
4 | console.log('...chopping done');
5 | let choppedVegetables = 'Chopped '+vegetables;
6 | sabziBanna(choppedVegetables); // Yeh ek callback hai, vegetables chop
7 | // huye and sabziBanna start
8 | },3000);
9 | }
10 |
11 | chopping("Aaloo",function(choppedVegetables){
12 | console.log('...Sabzi banana start with '+choppedVegetables);
13 | setTimeout(()=>{
14 | console.log('...Sabzi banana done');
15 | },3000);
16 | });
--------------------------------------------------------------------------------
/Lecture-16/Callbacks/details.txt:
--------------------------------------------------------------------------------
1 | - Callbacks are used to make async functions work in a synchronous way
2 |
--------------------------------------------------------------------------------
/Lecture-16/Promises/promise-2.js:
--------------------------------------------------------------------------------
1 | function foo(){
2 | return new Promise((resolve,reject)=>{
3 | setTimeout(()=>{
4 | console.log('..executing resolve');
5 | resolve('Done');
6 | },3000);
7 | })
8 | }
9 |
10 | let p = foo();
11 | console.log('...running .then');
12 | p.then((v)=>{
13 | console.log(v);
14 | });
15 |
16 | /*
17 | function foo(){
18 | return new Promise((resolve,reject)=>{
19 | console.log('..executing resolve');
20 | resolve('Done');
21 | })
22 | }
23 |
24 | let p = foo();
25 | setTimeout(()=>{
26 | console.log('..executing then');
27 | p.then((v)=>{
28 | console.log(v);
29 | });
30 | },2000);
31 | */
--------------------------------------------------------------------------------
/Lecture-16/Promises/promise.js:
--------------------------------------------------------------------------------
1 | // Promise is when something is "thenable", it uses a principle of duck typing
2 | function kalSeNahiPeeunga(){
3 | return new Promise(function(resolve,reject){
4 | setTimeout(()=>{
5 | // resolve(['ab saste nashe band',10]);
6 | resolve('ab saste nashe band');
7 | reject('Control Control Control');
8 | },3000);
9 | });
10 | }
11 |
12 | let p = kalSeNahiPeeunga();
13 | p.then(
14 | function(b){
15 | // agar promise resolve(fullfill) hua toh yeh chala do
16 | console.log(b);
17 | // console.log(b[0]);
18 | // console.log(b[1]);
19 | // console.log(x);
20 | },
21 | function(c){
22 | // agar promise reject hua toh yeh chala do
23 | console.log(c);
24 | }
25 | );
26 |
27 | // console.log(p instanceof Promise);
28 |
--------------------------------------------------------------------------------
/Lecture-16/Promises/promises-1.js:
--------------------------------------------------------------------------------
1 | function kalSeNahiPeeunga(date){
2 | return new Promise(function(resolve,reject){
3 | setTimeout(()=>{
4 | if(date == 'march')
5 | return resolve('ab saste nashe band');
6 | reject(new Error('Nahi ho paaya'));
7 | },3000);
8 | });
9 | }
10 |
11 | let p = kalSeNahiPeeunga('april');
12 |
13 | p.then((v)=>{
14 | console.log(v);
15 | }).catch((err)=>{
16 | console.log(err.message);
17 | })
18 |
19 | // p.then((v)=>{
20 | // console.log(v);
21 | // })
22 |
23 | // kalSeNahiPeeunga('march')
24 | // .then((v)=>{
25 | // console.log(v);
26 | // return v + ' april';
27 | // })
28 | // .then((v)=>{
29 | // console.log(v);
30 | // })
--------------------------------------------------------------------------------
/Lecture-16/Promises/thenable.js:
--------------------------------------------------------------------------------
1 | var p = {
2 | then: function(cb,rj){
3 | cb('This is thenable');
4 | rj('This is not good');
5 | }
6 | }
7 |
8 | p.then(function(v){
9 | console.log(v);
10 | },function(v1){
11 | console.log(v1);
12 | })
--------------------------------------------------------------------------------
/Lecture-17/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-17/.DS_Store
--------------------------------------------------------------------------------
/Lecture-17/Polyfill/bind.js:
--------------------------------------------------------------------------------
1 | let newCar = {
2 | name: 'BMW',
3 | price: '1Cr',
4 | color: 'red'
5 | }
6 |
7 | function Car(model,seats,type){
8 | console.log(this);
9 | console.log(`Name: ${this.name}, Price : ${this.price}, Color: ${this.color}`);
10 | console.log(`Model: ${model}, Seats: ${seats}, Type: ${type}`)
11 | }
12 |
13 |
14 | Function.prototype.mybind = function(...args){
15 | let fun = this; // this ek function hai jispar bind function call hua hai
16 |
17 | return function(...args1){
18 | fun.apply(args[0],[...args.splice(1),...args1]);
19 | }
20 | }
21 | let fun = Car.mybind(newCar,"2014",2);
22 | fun("Racing");
23 |
24 |
25 |
26 | /*
27 | let newCar = {
28 | name: 'BMW',
29 | price: '1Cr'
30 | }
31 |
32 | let bmw = Car.bind(newCar,"2014");
33 | bmw(2);
34 | */
--------------------------------------------------------------------------------
/Lecture-17/Polyfill/filter.js:
--------------------------------------------------------------------------------
1 | let arr = [1,2,3,4,5,6,7,8,9];
2 | let arr1 = arr.filter((value,indx,arr)=>{
3 | // console.log('index: '+indx + ' value: '+value + ' arr: '+arr);
4 | if(value%2 == 0) return true;
5 | return false;
6 | })
7 |
8 | console.log(arr1);
9 |
10 | Array.prototype.myfilter = function(cb){
11 | let newArr = [];
12 | for(let i = 0 ; i < this.length ; i++){
13 | if(cb(this[i],i,this)) newArr.push(this[i]);
14 | }
15 | return newArr;
16 | }
17 |
18 | let arr2 = arr.myfilter((value,indx,arr)=>{
19 | console.log('index: '+indx + ' value: '+value + ' arr: '+arr);
20 | if(value%2 == 0) return true;
21 | return false;
22 | })
23 | console.log(arr2);
24 |
--------------------------------------------------------------------------------
/Lecture-17/Polyfill/map.js:
--------------------------------------------------------------------------------
1 | let arr = [1,2,3,4];
2 | let arr1 = arr.map((v,indx,arr)=>{
3 | return v+ 10;
4 | });
5 |
6 | console.log(arr1);
7 |
8 | Array.prototype.mymap = function(cb){
9 | let oldArray = this;
10 | let newArray = [];
11 | for(let i = 0 ; i < oldArray.length; i++){
12 | newArray.push(cb(oldArray[i],i,oldArray));
13 | }
14 | return newArray;
15 | }
16 |
17 | let arr2 = arr.mymap((v,indx,arr)=>{
18 | return v + 10;
19 | })
20 |
21 | let arr3 = arr.mymap((v,indx,arr)=>{
22 | return v+20;
23 | })
24 |
25 | console.log(arr2);
26 | console.log(arr3);
--------------------------------------------------------------------------------
/Lecture-17/Polyfill/script.js:
--------------------------------------------------------------------------------
1 | function sum(x,y,z){
2 | return x + y + z
3 | }
4 |
5 | let arr = [1,2,3]
6 | let ans = sum(...arr);
7 | console.log(ans);
8 |
9 | function printArguments(...args){
10 | for(let i = 0 ; i < args.length ; i++){
11 | console.log(args[i]);
12 | }
13 | }
14 | printArguments("Hello World",true,1,2,3,4,5);
--------------------------------------------------------------------------------
/Lecture-18/Dom/console.txt:
--------------------------------------------------------------------------------
1 | const h1 = document.querySelector('h1');
2 | undefined
3 | h1.style.fontSize = '50px';
4 | '50px'
5 | h1.style.border = '2px solid black';
6 | '2px solid black'
7 | h1.style.padding = '10px';
8 | '10px'
9 | h1.style.backgroundColor = 'beige';
10 | 'beige'
11 | h1.style.textTransform = 'uppercase';
12 | 'uppercase'
13 | h1.style.textTransform = 'lowercase';
14 | 'lowercase'
15 | h1.style.textTransform = 'uppercase';
16 | 'uppercase'
17 | h1.style.textAlign = 'center';
18 | 'center'
19 | const span = document.querySelector('span')
20 | undefined
21 | span.style.fontWeight = 'bold'
22 | 'bold'
23 | span.style.color = 'aqua'
24 | 'aqua'
--------------------------------------------------------------------------------
/Lecture-18/Dom/details.txt:
--------------------------------------------------------------------------------
1 | 1. To select the elements from the DOM Tree to manipulate them
2 | Different Ways to select elements: Functions
3 | - getElementById
4 | - getElementsByClassName
5 | - getElementByTagName
6 | - querySelector
7 | - querySelectorAll
8 |
9 | 2. DOM Properties
10 | - innerText
11 | - innerHTML
12 | - TextContent
13 |
14 | 3. element.getAttribute('id'), element.setAttribute('id','cb');
--------------------------------------------------------------------------------
/Lecture-18/Dom/script.js:
--------------------------------------------------------------------------------
1 | console.log(document);
2 |
3 | let elements = document.getElementsByTagName('li');
4 | console.log(elements);
5 |
6 | for(let l of elements){
7 | // console.log(l);
8 | l.style.fontSize = '24px';
9 | l.style.color = 'blue';
10 | }
11 |
12 | for(let i = 0 ; i < elements.length ;i++){
13 | l = elements[i];
14 | l.style.fontSize = '24px';
15 | l.style.color = 'green';
16 | }
17 |
18 | let flag = 1;
19 | const h1 = document.querySelector('h1');
20 | setInterval(()=>{
21 |
22 | // if(flag == 1) h1.style.color = 'orange', h1.style.border='10px solid black',flag++;
23 | // else if(flag == 2) h1.style.color = 'green',h1.style.border='10px dotted black',flag++;
24 | // else h1.style.color = 'blue',flag = 1;
25 |
26 | // flag = !flag;
27 | },1000);
--------------------------------------------------------------------------------
/Lecture-19/Dom-events/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
13 |
14 |
15 | Dom Events
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Lecture-19/Dom-events/script.js:
--------------------------------------------------------------------------------
1 | const btn = document.querySelector('button');
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Lecture-19/Dom-manipulation/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-19/Dom-manipulation/.DS_Store
--------------------------------------------------------------------------------
/Lecture-19/Dom-manipulation/img/img1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-19/Dom-manipulation/img/img1.jpg
--------------------------------------------------------------------------------
/Lecture-19/Dom-manipulation/img/img2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-19/Dom-manipulation/img/img2.jpg
--------------------------------------------------------------------------------
/Lecture-19/Dom-manipulation/img/img3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-19/Dom-manipulation/img/img3.jpg
--------------------------------------------------------------------------------
/Lecture-19/Dom-manipulation/img/kartik.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-19/Dom-manipulation/img/kartik.png
--------------------------------------------------------------------------------
/Lecture-19/Dom-manipulation/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Lecture-2/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/.DS_Store
--------------------------------------------------------------------------------
/Lecture-2/HTML/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/HTML/.DS_Store
--------------------------------------------------------------------------------
/Lecture-2/HTML/images.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Lecture-2/HTML/img/img1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/HTML/img/img1.jpg
--------------------------------------------------------------------------------
/Lecture-2/HTML/img/img2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/HTML/img/img2.jpg
--------------------------------------------------------------------------------
/Lecture-2/HTML/img/img3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/HTML/img/img3.jpg
--------------------------------------------------------------------------------
/Lecture-2/HTML/img/kartik.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/HTML/img/kartik.png
--------------------------------------------------------------------------------
/Lecture-2/LearningCSS/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/LearningCSS/.DS_Store
--------------------------------------------------------------------------------
/Lecture-2/LearningCSS/img/img1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/LearningCSS/img/img1.jpg
--------------------------------------------------------------------------------
/Lecture-2/LearningCSS/img/img2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/LearningCSS/img/img2.jpg
--------------------------------------------------------------------------------
/Lecture-2/LearningCSS/img/img3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/LearningCSS/img/img3.jpg
--------------------------------------------------------------------------------
/Lecture-2/LearningCSS/img/kartik.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-2/LearningCSS/img/kartik.png
--------------------------------------------------------------------------------
/Lecture-2/LearningCSS/style.css:
--------------------------------------------------------------------------------
1 | h1 {
2 | color: rgb(45, 248, 238);
3 | }
4 | p {
5 | font-size: 20px;
6 | }
7 |
--------------------------------------------------------------------------------
/Lecture-20/1.Dom-Events/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 | Dom Events
12 |
13 |
14 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Lecture-20/1.Dom-Events/script.js:
--------------------------------------------------------------------------------
1 | let btn = document.querySelector('#btn');
2 |
3 | function shout(){
4 | console.log('Shouuttttt!!!!!');
5 | }
6 |
7 | function scream(){
8 | console.log('Screeeaaammm!!!!!');
9 | }
10 |
11 | btn.onclick = ()=>{
12 | console.log('I am clicked!!!!!!!');
13 | }
14 |
15 | btn.onclick = shout;
16 | btn.onclick = scream;
17 |
18 | let x = 1;
19 | btn.onclick = ()=>{
20 | if(x%2 == 0) shout();
21 | else scream();
22 | x++;
23 | }
--------------------------------------------------------------------------------
/Lecture-20/1.Dom-Events/style.css:
--------------------------------------------------------------------------------
1 | .heading{
2 | background-color: blueviolet;
3 | color: chartreuse;
4 | text-decoration: underline;
5 | }
--------------------------------------------------------------------------------
/Lecture-21/Calculator/script.js:
--------------------------------------------------------------------------------
1 | let screen = document.querySelector('#screen');
2 | let btns = document.querySelectorAll('button');
3 |
4 | for(let b of btns){
5 | b.addEventListener('click',(ev)=>{
6 | // console.log(ev.target.innerText);
7 | if(ev.target.innerText === 'C'){
8 | screen.value = '';
9 | }
10 | else if(ev.target.innerText === '='){
11 | try{
12 | screen.value = eval(screen.value);
13 | }
14 | catch(e){
15 | screen.value = 'Invalid Operation';
16 | }
17 | }
18 | else screen.value += ev.target.innerText;
19 |
20 | })
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/Lecture-21/Calculator/style.css:
--------------------------------------------------------------------------------
1 | *{
2 | margin: 0;
3 | padding: 0;
4 | }
5 | #container{
6 | width: 250px;
7 | border: 1px solid black;
8 | margin: 20px auto;
9 | }
10 |
11 | #container h4{
12 | text-align: center;
13 | }
14 |
15 | #screen{
16 | display: block;
17 | margin: auto;
18 | }
19 |
20 | table{
21 | border: 5px solid #ccc;
22 | margin: 20px auto;
23 | }
24 |
25 | td{
26 | border: 1px solid #ccc;
27 | height: 30px;
28 | width: 30px;
29 | box-shadow: 1px 1px 5px rgb(85, 85, 85);
30 | }
31 |
32 | td:active{
33 | transform: scale(0.9);
34 | }
35 |
36 | button{
37 | height: 100%;
38 | width: 100%;
39 | border: none;
40 | }
--------------------------------------------------------------------------------
/Lecture-21/DOM-Events/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 | DOM EVENTS
12 |
13 |
14 |
15 | This is my paragraph!
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Lecture-21/DOM-Events/style.css:
--------------------------------------------------------------------------------
1 | .disable{
2 | background-color: red;
3 | }
4 |
5 | .blacktheme{
6 | background-color: black;
7 | color: white;
8 | }
--------------------------------------------------------------------------------
/Lecture-21/Event-Cycle(CTB)/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
17 |
18 |
19 |
20 | grandfather
21 |
22 | father
23 |
child
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Lecture-21/Event-Cycle(CTB)/script.js:
--------------------------------------------------------------------------------
1 | let grandfather = document.querySelector('#grandfather');
2 | let father = document.querySelector('#father');
3 | let child = document.querySelector('#child');
4 |
5 | grandfather.addEventListener('click',(ev)=>{
6 | console.log('grandfather');
7 | ev.stopPropagation();
8 | },true);// by default false hota hai toh bubbling ke time par events run honge
9 |
10 | father.addEventListener('click',(ev)=>{
11 | console.log('father');
12 | ev.stopPropagation();
13 | },true);
14 |
15 | child.addEventListener('click',(ev)=>{
16 | console.log('child');
17 | ev.stopPropagation();
18 | },true);
19 |
--------------------------------------------------------------------------------
/Lecture-21/Event-Cycle(CTB)/style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-21/Event-Cycle(CTB)/style.css
--------------------------------------------------------------------------------
/Lecture-21/Event-Delegation/console.txt:
--------------------------------------------------------------------------------
1 | let btn1 = document.createElement('button');
2 | undefined
3 | btn1.innerText = '10'
4 | '10'
5 | let container = document.querySelector('#container');
6 | undefined
7 | container.appendChild(btn1);
8 |
9 |
10 | // New button add krne par, eventListner kaam nhi krega because ek ek
11 | // button par add kia hai humne eventListner ko
--------------------------------------------------------------------------------
/Lecture-21/Event-Delegation/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
A Div
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Lecture-21/Event-Delegation/script.js:
--------------------------------------------------------------------------------
1 | let container = document.getElementById('container');
2 | container.addEventListener('click',(ev)=>{
3 | // console.log(ev);
4 | if(ev.target.nodeName === 'BUTTON')
5 | console.log(ev.target.innerText);
6 | })
7 |
8 | // let btns = document.querySelectorAll('button');
9 |
10 | // for(let b of btns){
11 | // b.addEventListener('click',function(ev){
12 | // console.log(this.innerText);
13 | // })
14 | // }
--------------------------------------------------------------------------------
/Lecture-21/Event-Delegation/style.css:
--------------------------------------------------------------------------------
1 | button{
2 | height: 150px;
3 | width: 150px;
4 | margin: 20px;
5 | }
--------------------------------------------------------------------------------
/Lecture-22/1.JqueryBasics/chaining.js:
--------------------------------------------------------------------------------
1 | // TO return the reference of same element that is called as FLUENT API
2 | class Person{
3 | constructor(){
4 | /////
5 | return this;
6 | }
7 |
8 | age(){
9 | ////
10 | return this;
11 | }
12 |
13 | name(){
14 | ///
15 | return this;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-22/1.JqueryBasics/console.txt:
--------------------------------------------------------------------------------
1 | $('#div')
2 | S.fn.init [div#div]0: div#divlength: 1[[Prototype]]: Object(0)
3 | document.querySelector('#div')
4 | Hello World!
5 | jQuery('#div')
6 | S.fn.init [div#div]0: div#divlength: 1[[Prototype]]: Object(0)
7 | let d = document.querySelector('#div')
8 | undefined
9 | d.style.backgroundColor = 'red';
10 | 'red'
11 | $('#div').css('background-color','purple');
12 | S.fn.init [div#div]
13 | $('#div').attr('id')
14 | 'div'
15 | $('#div').attr('id','mydiv');
16 | S.fn.init [div#mydiv]
17 |
18 | let x = $('#div')
19 | undefined
20 | let y = $('#div').css('color','orange');
21 | undefined
22 | x == y
23 | false
24 | let z = x
25 | undefined
26 | z == x
27 | true
28 | z.css('color','white');
29 | S.fn.init [div#div]
--------------------------------------------------------------------------------
/Lecture-22/1.JqueryBasics/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Lecture-22/1.JqueryBasics/style.css:
--------------------------------------------------------------------------------
1 | .myclass{
2 | background-color: orange;
3 | }
--------------------------------------------------------------------------------
/Lecture-22/2.TodoList/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Lecture-22/2.TodoList/style.css:
--------------------------------------------------------------------------------
1 | button{
2 | margin: 0 5px;
3 | }
4 |
5 | li{
6 | margin: 10px auto;
7 | }
8 |
9 | ul li:first-child .btn-up,
10 | ul li:last-child .btn-down{
11 | display: none;
12 | }
13 |
--------------------------------------------------------------------------------
/Lecture-22/3.DOM-Working/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Lecture-22/3.DOM-Working/script.js:
--------------------------------------------------------------------------------
1 | let input = document.querySelector('#inp');
2 | let btn = document.querySelector('#btn');
3 | let list = document.querySelector('#list');
4 |
5 | btn.addEventListener('click',(ev)=>{
6 | // console.log(typeof input.value)
7 | let n = parseInt(input.value);
8 | for(let i = 1 ; i <= n ; i++){
9 | list.innerHTML += `${i}`
10 | }
11 | // console.log(n);
12 | // console.log(typeof n);
13 | })
--------------------------------------------------------------------------------
/Lecture-23/1. Json/script-1.js:
--------------------------------------------------------------------------------
1 | let data =
2 | '{"ticker":{"base":"BTC","target":"USD","price":"21357.89467993","volume":"14352.93869727","change":"-29.83670711"},"timestamp":1662798243,"success":true,"error":""}';
3 |
4 | let res = JSON.parse(data);
5 | console.log(data);
6 | console.log(res);
7 |
8 | let jsdata = [
9 | {
10 | firstName: "Dhruv",
11 | lastName: "Sehgal",
12 | age: 24,
13 | hobbies: {
14 | ludo: true,
15 | cricket: false,
16 | },
17 | equipments: ["laptop", "onePlus"],
18 | },
19 | {
20 | firstName: "Dhruv",
21 | lastName: "Sehgal",
22 | age: 24,
23 | hobbies: {
24 | ludo: true,
25 | cricket: false,
26 | },
27 | equipments: ["laptop", "onePlus"],
28 | },
29 | ];
30 |
31 | res = JSON.stringify(jsdata);
32 | console.log(res);
33 |
--------------------------------------------------------------------------------
/Lecture-23/1. Json/script.js:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | firstName: 'Dhruv',
4 | lastName: 'Sehgal',
5 | age: 24,
6 | hobbies: {
7 | ludo: true,
8 | cricket: false
9 | },
10 | equipments:['laptop','onePlus']
11 | },
12 | {
13 | firstName: 'Dhruv',
14 | lastName: 'Sehgal',
15 | age: 24,
16 | hobbies: {
17 | ludo: true,
18 | cricket: false
19 | },
20 | equipments:[
21 | 'laptop','onePlus'
22 | ]
23 | }
24 | ]
--------------------------------------------------------------------------------
/Lecture-23/2. Api/another.js:
--------------------------------------------------------------------------------
1 | const firstName = 'Dhruv';
2 |
3 |
--------------------------------------------------------------------------------
/Lecture-23/2. Api/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 | AJAX
14 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/Lecture-23/3. MovieApp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 | Movie Search App
15 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Lecture-23/3. MovieApp/style.css:
--------------------------------------------------------------------------------
1 | h1{
2 | text-align: center;
3 | }
4 |
5 | section{
6 | width: 80vw;
7 | margin: auto;
8 | border: 1px solid black;
9 | margin-bottom: 10px;
10 | }
11 |
12 | input,
13 | button{
14 | padding: 5px;
15 | font-size: 16px;
16 | }
17 |
18 | #movieContainer{
19 | display: flex;
20 | justify-content: space-around;
21 | flex-wrap: wrap;
22 | }
--------------------------------------------------------------------------------
/Lecture-23/4. Geolocation/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 | xw
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Lecture-23/4. Geolocation/script.js:
--------------------------------------------------------------------------------
1 | navigator.geolocation.getCurrentPosition((position) => {
2 | console.log(position);
3 | const { latitude, longitude } = position.coords;
4 | console.log(latitude, longitude);
5 | });
6 |
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/1. Modules/lib1.js:
--------------------------------------------------------------------------------
1 | console.log('requiring lib1');
2 |
3 | let a = 10;
4 | function add (a,b){
5 | return a + b;
6 | }
7 |
8 | function subtract(a,b){
9 | return a-b;
10 | }
11 |
12 | let marks;
13 |
14 | function marksUpdate(){
15 | marks = 100;
16 | }
17 | marksUpdate();
18 |
19 | console.log("Marks: " +marks);
20 |
21 | module.exports.a = a;
22 | module.exports.add = add;
23 | module.exports.subtract = subtract;
24 |
25 | // console.log(module.exports);
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/1. Modules/main.js:
--------------------------------------------------------------------------------
1 | const {add,a,subtract} = require('./lib1');
2 |
3 | console.log("Add(10,20) "+add(10,20));
4 | console.log("Add(10,20) "+addition(10,200));
5 | console.log("Subtract(10,20) "+subtract(10,20));
6 | console.log("a "+a);
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/2.FileDependency/lib1.js:
--------------------------------------------------------------------------------
1 | let lib2 = require('./lib2');
2 | console.log('running lib1');
3 |
4 | function cat(){
5 | console.log('cat says meoww!');
6 | }
7 |
8 | let food = 'fish';
9 |
10 | module.exports.cat = cat;
11 | module.exports.food = food;
12 | module.exports.lib2 = lib2;
13 | // module.exports = {
14 | // cat,
15 | // food,
16 | // lib2
17 | // }
18 |
19 |
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/2.FileDependency/lib2.js:
--------------------------------------------------------------------------------
1 | let lib1 = require('./lib1');
2 | console.log('running lib2');
3 |
4 | function dog(){
5 | console.log('dog says wuff!');
6 | }
7 |
8 | let food = 'parle-G';
9 |
10 | module.exports.dog = dog;
11 | module.exports.food = food;
12 | module.exports.lib1 = lib1;
13 | // module.exports = {
14 | // dog,
15 | // food,
16 | // lib1
17 | // }
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/2.FileDependency/main.js:
--------------------------------------------------------------------------------
1 | let lib1 = require('./lib1');
2 | let lib2 = require('./lib2');
3 |
4 | console.log(lib1);
5 | console.log(lib2);
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/SortNumbersQuestion/input1.txt:
--------------------------------------------------------------------------------
1 | -1
2 | -2
3 | -3
4 | 3
5 | 32
6 | 2
7 | 525
8 | 343
9 | 6
10 | 5
11 | 34
12 | 54
13 | 45
14 | 43
15 | 54
16 | 5
17 | 3
18 | 534
19 | 64
20 | 3654
21 | 56
22 | 54
23 | 5454
24 | 7
25 | 54754
26 | 7
27 | 45
28 | 3
29 | 46
30 | 3
31 | 54
32 | 7
33 | 54
34 | 63
35 | 7
36 | 45
37 | 64
38 | 7
39 | 35
40 | 6
41 | 3
42 | 6
43 | 47
44 | 56
45 | 8
46 | 45
47 | 6
48 | 3
49 | 7
50 | 468
51 | 46
52 | 3
53 | 7
54 | 46
55 | 876
56 | 9
57 | 674
58 | 7
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/SortNumbersQuestion/input2.txt:
--------------------------------------------------------------------------------
1 | 78
2 | 67
3 | 48
4 | 5
5 | 84
6 | 5
7 | 5
8 | 57
9 | 5
10 | 74
11 | 63
12 | 7
13 | 679
14 | 870
15 | 9
16 | 37
17 | 56
18 | 54756
19 | 8678
20 | 7
21 | 3
22 | 52
23 | 34645
24 | 7
25 | 568
26 | 53
27 | 46
28 | 57
29 | 67
30 | 5
31 | 3
32 | 54
33 | 645
34 | 6
35 | 3
36 | 73525
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/SortNumbersQuestion/out.txt:
--------------------------------------------------------------------------------
1 | -3,-2,-1,2,3,3,3,3,3,3,3,3,3,3,5,5,5,5,5,5,5,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,8,9,9,32,34,35,37,43,45,45,45,45,46,46,46,46,47,48,52,53,54,54,54,54,54,54,56,56,56,57,57,63,63,64,64,67,67,74,84,343,468,525,534,568,645,674,679,778,870,876,3654,5454,8678,34645,54754,54756,73525
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/SortNumbersQuestion/script.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | let ans;
4 | fs.readFile(
5 | 'input1.txt',
6 | (err,data)=>{
7 | ans = data.toString();
8 | fs.readFile(
9 | 'input2.txt',
10 | (err,d)=>{
11 | ans += d.toString();
12 | console.log(ans);
13 | let arr = ans.split('\n');
14 | // console.log(arr);
15 | arr.sort((a,b)=>a-b);
16 | console.log(arr);
17 |
18 | fs.writeFile('out.txt',arr.toString(),(err)=>{
19 | console.log('Done');
20 | })
21 | }
22 | )
23 | }
24 | )
25 |
26 |
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/myFiles/hello.txt:
--------------------------------------------------------------------------------
1 | Updating the hello world text!!!Hello World again!!
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/path.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 |
3 | console.log(path.join('/a/','/b','/c'));
4 | console.log('/a/'+'/b'+'/c');
5 | console.log(__dirname);
6 |
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/readFile.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | const path = require('path');
3 | const FileLocation = path.join(__dirname,'myFiles');
4 |
5 | const file = path.join(FileLocation,'hello.txt');
6 |
7 | fs.readFile(
8 | file,
9 | {
10 | encoding:'utf-8'
11 | },
12 | (err,data)=>{
13 | if(err){
14 | console.log(err.message);
15 | return;
16 | }
17 | console.log(data);
18 | }
19 | )
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/3.File handling/writeFile.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | const path = require('path');
3 | const FileLocation = path.join(__dirname,'myFiles');
4 |
5 | const file = path.join(FileLocation,'hello.txt');
6 |
7 | fs.writeFile(
8 | file,
9 | "Hello World again!!",
10 | {
11 | encoding: "utf-8",
12 | flag: "a",
13 | },
14 | (err) => {
15 | if (err) {
16 | console.log("Issues with file writing "+err.message);
17 | } else {
18 | console.log("File written successfully");
19 | }
20 | }
21 | );
22 |
23 | console.log('Running addition function');
24 | function add(){
25 | console.log(10+20);
26 | }
27 | add();
--------------------------------------------------------------------------------
/Lecture-24(NODEJS)/notes.md:
--------------------------------------------------------------------------------
1 | Object Functionalities
2 | - spread operator
3 |
4 |
5 |
6 | obj = {
7 | firstName:'Kartik',
8 | lastName: "Mathur",
9 | org:"Coding Blocks"
10 | }
11 |
12 | obj1 = {
13 | ...obj,
14 | profession:"Mentor"
15 | }
16 |
17 | console.log(obj1);
18 |
--------------------------------------------------------------------------------
/Lecture-25(AnimationProject)/css/style.css:
--------------------------------------------------------------------------------
1 | /* SETTING THE ELEMENTS ON THE PAGE TO APPLY ANIMATIONS */
2 | body{
3 | background-image: url('../images/Space.png');
4 | background-repeat: repeat-x;
5 | background-color: rgb(77, 107, 145);
6 | }
7 |
8 | .rocket-element{
9 | height: 200px;
10 | position: absolute;
11 | top: 450px;
12 | left: 400px;
13 | transform: rotateZ(45deg);
14 | }
15 |
16 | .cody{
17 | height: 150px;
18 | position: absolute;
19 | top: 480px;
20 | left: 280px;
21 | }
22 |
--------------------------------------------------------------------------------
/Lecture-25(AnimationProject)/images/Cody.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-25(AnimationProject)/images/Cody.png
--------------------------------------------------------------------------------
/Lecture-25(AnimationProject)/images/Space.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-25(AnimationProject)/images/Space.png
--------------------------------------------------------------------------------
/Lecture-25(AnimationProject)/images/rocket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-25(AnimationProject)/images/rocket.png
--------------------------------------------------------------------------------
/Lecture-25(AnimationProject)/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |

14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Lecture-26(ExpressJS)/1.ExpressBasics/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
--------------------------------------------------------------------------------
/Lecture-26(ExpressJS)/1.ExpressBasics/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "learningexpress",
3 | "version": "1.0.0",
4 | "description": "This is learning expressJS",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "kartik.mathur@codingblocks.com",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Lecture-26(ExpressJS)/2.ExpressFiles/script.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 | const path = require('path');
5 |
6 | // app.use(express.static(path.join(__dirname,'static')));
7 | // http://localhost:4444/
8 |
9 | app.get('/',(req,res,next)=>{
10 | console.log(__dirname);
11 | res.sendFile(path.join(__dirname,'static','index.html'));
12 | })
13 | /*
14 | // http://localhost:4444/app.js
15 | app.get('/app.js',(req,res)=>{
16 | res.send('console.log("Hello World");');
17 | })
18 |
19 | app.get('/lib.js',(req,res)=>{
20 | res.send('console.log("Hello library");');
21 | })
22 | */
23 |
24 | app.listen(PORT,()=>{
25 | console.log(`Server started at http://localhost:${PORT}/`);
26 | })
--------------------------------------------------------------------------------
/Lecture-26(ExpressJS)/2.ExpressFiles/static/app.js:
--------------------------------------------------------------------------------
1 | console.log('Inside Application File');
--------------------------------------------------------------------------------
/Lecture-26(ExpressJS)/2.ExpressFiles/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 | Print Numbers till N
13 |
16 |
17 |
--------------------------------------------------------------------------------
/Lecture-26(ExpressJS)/2.ExpressFiles/static/lib.js:
--------------------------------------------------------------------------------
1 | console.log('Inside Lib file');
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/1.API/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/1.API/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-implementation",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "script.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/1.API/script.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 | const path = require('path');
5 |
6 | app.use(express.urlencoded({extended: true}));
7 |
8 | app.use(express.static(path.join(__dirname,'static')));
9 |
10 | app.get('/information',(req,res)=>{
11 | console.log(req.query.username);
12 | console.log(req.query.password);
13 | console.log(req.query.mobile);
14 | res.send(`You entered: ${req.query.username}, ${req.query.password}, ${req.query.mobile}`);
15 | })
16 |
17 | app.post('/information',(req,res)=>{
18 | console.log(req.body);
19 | res.send(`You entered:${req.body.username}, ${req.body.password}, ${req.body.mobile}`);
20 | })
21 |
22 | app.listen(PORT,()=>{
23 | console.log('http://localhost:'+PORT);
24 | })
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/1.API/static/js/app.js:
--------------------------------------------------------------------------------
1 | console.log('Running app.js');
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/2.Todo-API/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/2.Todo-API/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "2.todo-api",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/2.Todo-API/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 | Todo List
14 |
18 |
19 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Lecture-27(ExpressJS)/2.Todo-API/tasks.txt:
--------------------------------------------------------------------------------
1 | Swimming
2 | Dancing
3 | Singing
4 | Karate
5 | Crickets
--------------------------------------------------------------------------------
/Lecture-28(Templates)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-28(Templates)/TodoList/mytasks.txt:
--------------------------------------------------------------------------------
1 | Gym
2 | Coding
3 | Coder
4 | Blocks
5 | Coder
6 | Football
7 |
--------------------------------------------------------------------------------
/Lecture-28(Templates)/TodoList/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "todolist",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Lecture-28(Templates)/TodoList/views/index.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{title}}
8 |
9 |
10 | To Do List
11 |
15 |
16 |
17 | {{#each tasks as |task|}}
18 | {{#if task}}
19 | - {{task}}
20 | {{/if}}
21 | {{/each}}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Lecture-28(Templates)/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 |
4 | app.set('view engine','hbs');
5 |
6 | app.get('/',(req,res)=>{
7 | res.render('index',{
8 | title: 'HBS',
9 | subjects: ['English','C++','Java','Python','Data Science'],
10 | show: true
11 | });
12 | })
13 |
14 |
15 | app.listen(4444,()=>{
16 | console.log('http://localhost:4444');
17 | });
--------------------------------------------------------------------------------
/Lecture-28(Templates)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "learntemplates",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Lecture-28(Templates)/views/index.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{title}}
9 |
10 |
11 |
12 | My Templating Page
13 | {{#if show}}
14 |
15 |
16 | {{#each subjects as |subject|}}
17 | - {{subject}}
18 | {{/each}}
19 |
20 |
21 | {{/if}}
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Lecture-29/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-29/.DS_Store
--------------------------------------------------------------------------------
/Lecture-29/1.Routers/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-29/1.Routers/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 |
5 | app.use(express.urlencoded({extended: true}));
6 | const teachersRoute = require('./routers/teachers');
7 |
8 | app.use('/teachers',teachersRoute);
9 | app.use('/students',require('./routers/students'));
10 |
11 |
12 | app.listen(PORT,()=>{
13 | console.log('http://localhost:'+PORT);
14 | })
--------------------------------------------------------------------------------
/Lecture-29/1.Routers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "1.routers",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Lecture-29/1.Routers/routers/students.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const Router = express.Router();
3 | const students = [];
4 |
5 |
6 | Router.get('/',(req,res)=>{
7 | res.send(students);
8 | })
9 |
10 | Router.post('/',(req,res)=>{
11 | students.push({
12 | name: req.body.name,
13 | roll: req.body.roll,
14 | marks: req.body.marks
15 | });
16 | res.redirect('/kids');
17 | })
18 |
19 |
20 | module.exports = Router;
--------------------------------------------------------------------------------
/Lecture-29/1.Routers/routers/teachers.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const Router = express.Router();
3 | const teachers = [];
4 |
5 | Router.get('/',(req,res)=>{
6 | res.send(teachers);
7 | });
8 |
9 | Router.post('/',(req,res)=>{
10 | teachers.push({
11 | name: req.body.name,
12 | subject: req.body.subject
13 | });
14 | res.redirect('/teachers');
15 | });
16 |
17 | module.exports = Router;
--------------------------------------------------------------------------------
/Lecture-29/2.Middlewares/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-29/2.Middlewares/example.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 |
5 | function decode(req,res,next){
6 | if(req.query.type == 'password')
7 | console.log('Running decode function');
8 | next();
9 | }
10 |
11 | function encode(req,res,next){
12 | if(req.query.type == 'password' || req.query.type == 'image')
13 | console.log('Running encode');
14 | next();
15 | }
16 |
17 | function compress(req,res,next){
18 | console.log('Running compress');
19 | next();
20 | }
21 |
22 | app.use('/abc',decode);
23 | app.use(compress);
24 | app.use(encode);
25 |
26 | app.get('/',(req,res)=>{
27 | res.send('Hello World');
28 | })
29 |
30 |
31 | app.listen(PORT,()=>{
32 | console.log('http://localhost:'+PORT);
33 | })
--------------------------------------------------------------------------------
/Lecture-29/2.Middlewares/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "2.middlewares",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "script.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Lecture-29/2.Middlewares/script.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 |
5 | function m1(req,res,next){
6 | console.log('Running m1');
7 | next();
8 | }
9 |
10 | function m2(req,res,next){
11 | console.log('Running m2');
12 | next();
13 | }
14 |
15 | function m3(req,res,next){
16 | console.log('Running m3');
17 | next();
18 | }
19 |
20 | app.use(m1);
21 | app.use(m2);
22 | app.use(m3);
23 |
24 | app.get('/',(req,res)=>{
25 | res.send('Hello World');
26 | })
27 |
28 | app.get('/teachers/addteacher',(req,res)=>{
29 | res.send('Hi! There');
30 | })
31 |
32 | app.listen(PORT,()=>{
33 | console.log('http://localhost:'+PORT);
34 | })
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 |
5 | app.use(express.urlencoded({extended: true}));
6 | app.use(express.static(__dirname+'/public'));
7 |
8 | app.set('view engine','hbs');
9 |
10 | app.use('/admin',require('./routers/admin').Router);
11 | app.use('/user',require('./routers/user'));
12 |
13 |
14 |
15 | app.listen(PORT,()=>{
16 | console.log('http://localhost:'+PORT);
17 | })
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "3.adminanduserportal",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | Welcome to Todo App
11 |
14 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/routers/admin.js:
--------------------------------------------------------------------------------
1 | const Router = require('express').Router();
2 | const admins=['kartik','monu'];
3 | const taskList = [];
4 |
5 | Router.get('/',(req,res)=>{
6 | res.render('admin',{
7 | taskList
8 | });
9 | })
10 |
11 | Router.post('/',(req,res)=>{
12 | if(admins.indexOf(req.body.name) != -1){
13 | taskList.push(req.body.newtask);
14 | }
15 | res.redirect('/admin');
16 | })
17 |
18 | module.exports.Router = Router;
19 | module.exports.taskList = taskList;
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/routers/user.js:
--------------------------------------------------------------------------------
1 | const Router = require('express').Router();
2 | const {taskList} = require('./admin');
3 |
4 | Router.get('/',(req,res)=>{
5 | res.render('user',{taskList});
6 | })
7 |
8 |
9 | module.exports = Router;
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/views/admin.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | Welcome to admin portal
11 |
16 |
17 |
18 | {{#each taskList as |task|}}
19 | - {{task}}
20 | {{/each}}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Lecture-29/3.AdminAndUserPortal/views/user.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 | Welcome to todo app!
13 |
14 | {{#each taskList as |task|}}
15 | - {{task}}
16 | {{/each}}
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Lecture-3/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-3/.DS_Store
--------------------------------------------------------------------------------
/Lecture-3/LearningCSS/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-3/LearningCSS/.DS_Store
--------------------------------------------------------------------------------
/Lecture-3/LearningCSS/code/style-1.css:
--------------------------------------------------------------------------------
1 | /* SELECTORS */
2 | h1 {
3 | color: rgb(40, 197, 189);
4 | font-size: 40px;
5 | }
6 |
7 | p {
8 | font-size: 20px;
9 | }
10 | /* !SELECTORS */
11 |
--------------------------------------------------------------------------------
/Lecture-3/LearningCSS/img/img1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-3/LearningCSS/img/img1.jpg
--------------------------------------------------------------------------------
/Lecture-3/LearningCSS/img/img2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-3/LearningCSS/img/img2.jpg
--------------------------------------------------------------------------------
/Lecture-3/LearningCSS/img/img3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-3/LearningCSS/img/img3.jpg
--------------------------------------------------------------------------------
/Lecture-3/LearningCSS/img/kartik.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-3/LearningCSS/img/kartik.png
--------------------------------------------------------------------------------
/Lecture-30(MVC)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-30(MVC)/app.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const app = express();
4 | const PORT = 4444;
5 |
6 | app.set('view engine','hbs');
7 | app.use(express.urlencoded({extended:true}));
8 | app.use(express.static(path.join(__dirname,'public')));
9 |
10 | const adminRoute = require(path.join(__dirname,'routes','admin')).router;
11 | const shopRoute = require(path.join(__dirname,'routes','shop'));
12 | // /admin/add-product
13 | app.use('/admin',adminRoute);
14 | app.use('/',shopRoute);
15 |
16 |
17 | app.listen(PORT,()=>{
18 | console.log(`http://localhost:`+PORT);
19 | });
--------------------------------------------------------------------------------
/Lecture-30(MVC)/controllers/shop.js:
--------------------------------------------------------------------------------
1 | // const products = require('./admin').products;
2 | const Product = require('../models/product');
3 |
4 | module.exports.getShop = (req,res,next)=>{
5 | Product.getAllProducts((products)=>{
6 | res.render(
7 | './shop/shop',{
8 | path:'/',
9 | products,
10 | hasProducts: products.length>0
11 | }
12 | )
13 | })
14 |
15 | };
--------------------------------------------------------------------------------
/Lecture-30(MVC)/data/product.json:
--------------------------------------------------------------------------------
1 | [{"name":"Reebok","price":"20","description":"asdakdasd","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"},{"name":"Reebok","price":"20","description":"asdakdasd","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"}]
--------------------------------------------------------------------------------
/Lecture-30(MVC)/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-30(MVC)/index.html
--------------------------------------------------------------------------------
/Lecture-30(MVC)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Lecture-30(MVC)/public/css/form.css:
--------------------------------------------------------------------------------
1 | .product {
2 | border: 1px solid black;
3 | width: 200px;
4 | margin: 10px;
5 | display: flex;
6 | flex-wrap: wrap;
7 | }
--------------------------------------------------------------------------------
/Lecture-30(MVC)/public/garbage.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-30(MVC)/public/garbage.txt
--------------------------------------------------------------------------------
/Lecture-30(MVC)/routes/admin.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const adminController = require('../controllers/admin');
5 |
6 | router.get('/product-list',adminController.getProductList);
7 | router.post('/add-product',adminController.postAddProducts);
8 |
9 | module.exports.router=router;
--------------------------------------------------------------------------------
/Lecture-30(MVC)/routes/shop.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const products = require('./admin').products;
5 | const shopController = require('../controllers/shop');
6 | router.get('/',shopController.getShop);
7 |
8 |
9 | module.exports=router;
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-31(ShoppingCart)/.DS_Store
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/app.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const app = express();
4 | const PORT = 4444;
5 | var hbs = require('hbs');
6 |
7 | hbs.registerPartials(__dirname + '/views/partials');
8 | app.set('view engine','hbs');
9 | app.use(express.urlencoded({extended:true}));
10 | app.use(express.static(path.join(__dirname,'public')));
11 |
12 | const adminRoute = require(path.join(__dirname,'routes','admin')).router;
13 | const shopRoute = require(path.join(__dirname,'routes','shop'));
14 | // /admin/add-product
15 | app.use('/admin',adminRoute);
16 | app.use('/',shopRoute);
17 |
18 |
19 | app.listen(PORT,()=>{
20 | console.log(`http://localhost:`+PORT);
21 | });
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/data/cart.json:
--------------------------------------------------------------------------------
1 | {"products":[{"id":"0.9945583243546856","qty":2}],"totalPrice":200}
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/data/product.json:
--------------------------------------------------------------------------------
1 | [{"id":"0.9945583243546856","name":"Nike","price":"100","description":"Superb Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"},{"id":"0.9603224872112981","name":"Reebok","price":"120","description":"Amazing Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"}]
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-31(ShoppingCart)/index.html
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0",
14 | "mysql2": "^2.3.3"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/public/css/form.css:
--------------------------------------------------------------------------------
1 | .product {
2 | width: 1200px;
3 | margin: 10px;
4 | display: flex;
5 | flex-wrap: wrap;
6 | }
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/public/css/style.css:
--------------------------------------------------------------------------------
1 | .product-image{
2 | width: 200px;
3 | }
4 |
5 | .product-card{
6 | border: 1px solid black;
7 | margin: 10px;
8 | }
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/public/garbage.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-31(ShoppingCart)/public/garbage.txt
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/routes/admin.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const adminController = require('../controllers/admin');
5 |
6 | router.get('/product-list',adminController.getProductList);
7 |
8 | router.get('/add-product',adminController.getAddProducts);
9 | router.post('/add-product',adminController.postAddProducts);
10 |
11 | router.get('/edit-product',adminController.getEditProduct);
12 | router.post('/edit-product',adminController.postEditProduct);
13 |
14 | router.post('/delete-product',adminController.postDeleteProduct);
15 |
16 | module.exports.router=router;
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/routes/shop.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const products = require('./admin').products;
5 | const shopController = require('../controllers/shop');
6 |
7 | router.get('/',shopController.getShop);
8 | router.get('/cart',shopController.getCart);
9 | router.post('/add-to-cart',shopController.postAddToCart);
10 | router.post('/delete-cart-item',shopController.postAddCartItem);
11 |
12 |
13 | module.exports=router;
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/views/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-31(ShoppingCart)/views/.DS_Store
--------------------------------------------------------------------------------
/Lecture-31(ShoppingCart)/views/partials/navbar.hbs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/.DS_Store
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/ShoppingCart-Sequelize/.DS_Store
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/app.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const app = express();
4 | const PORT = 4444;
5 | var hbs = require('hbs');
6 | const db = require('./util/database');
7 |
8 | hbs.registerPartials(__dirname + '/views/partials');
9 | app.set('view engine','hbs');
10 | app.use(express.urlencoded({extended:true}));
11 | app.use(express.static(path.join(__dirname,'public')));
12 |
13 | const adminRoute = require(path.join(__dirname,'routes','admin')).router;
14 | const shopRoute = require(path.join(__dirname,'routes','shop'));
15 | // /admin/add-product
16 | app.use('/admin',adminRoute);
17 | app.use('/',shopRoute);
18 |
19 |
20 | db.sync().then(()=>{
21 | app.listen(PORT,()=>{
22 | console.log(`http://localhost:`+PORT);
23 | });
24 | }).catch(err=>{
25 | console.log(err);
26 | })
27 |
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/data/cart.json:
--------------------------------------------------------------------------------
1 | {"products":[{"id":"0.9945583243546856","qty":2}],"totalPrice":200}
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/data/product.json:
--------------------------------------------------------------------------------
1 | [{"id":"0.9945583243546856","name":"Nike","price":"100","description":"Superb Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"},{"id":"0.9603224872112981","name":"Reebok","price":"120","description":"Amazing Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"}]
2 |
3 |
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/ShoppingCart-Sequelize/index.html
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/models/product.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const path = require('path');
3 | const sequelize = require('../util/database');
4 | const Sequelize = require('sequelize');
5 |
6 | const Products = sequelize.define('products',{
7 | id:{
8 | type: Sequelize.INTEGER,
9 | allowNull: false,
10 | autoIncrement: true,
11 | primaryKey: true
12 | },
13 | name:{
14 | type: Sequelize.STRING,
15 | allowNull: false
16 | },
17 | description:{
18 | type: Sequelize.STRING,
19 | allowNull: false
20 | },
21 | price:{
22 | type: Sequelize.DOUBLE,
23 | allowNull: false
24 | },
25 | imageUrl:{
26 | type: Sequelize.STRING,
27 | allowNull: false
28 | }
29 | })
30 |
31 | module.exports = Products;
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0",
14 | "mysql2": "^2.3.3",
15 | "sequelize": "^6.25.1"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/public/css/form.css:
--------------------------------------------------------------------------------
1 | .product {
2 | width: 1200px;
3 | margin: 10px;
4 | display: flex;
5 | flex-wrap: wrap;
6 | }
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/public/css/style.css:
--------------------------------------------------------------------------------
1 | .product-image{
2 | width: 200px;
3 | }
4 |
5 | .product-card{
6 | border: 1px solid black;
7 | margin: 10px;
8 | }
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/public/garbage.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/ShoppingCart-Sequelize/public/garbage.txt
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/routes/admin.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const adminController = require('../controllers/admin');
5 |
6 | router.get('/product-list',adminController.getProductList);
7 |
8 | router.get('/add-product',adminController.getAddProducts);
9 | router.post('/add-product',adminController.postAddProducts);
10 |
11 | router.get('/edit-product',adminController.getEditProduct);
12 | router.post('/edit-product',adminController.postEditProduct);
13 |
14 | router.post('/delete-product',adminController.postDeleteProduct);
15 |
16 | module.exports.router=router;
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/routes/shop.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const products = require('./admin').products;
5 | const shopController = require('../controllers/shop');
6 |
7 | router.get('/',shopController.getShop);
8 | router.get('/cart',shopController.getCart);
9 | router.post('/add-to-cart',shopController.postAddToCart);
10 | router.post('/delete-cart-item',shopController.postAddCartItem);
11 |
12 |
13 | module.exports=router;
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/util/database.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const sequelize = new Sequelize(
3 | 'shoppingCart',
4 | 'root',
5 | 'KartikM@1994', {
6 | host: 'localhost',
7 | dialect: 'mysql'
8 | }
9 | );
10 |
11 | module.exports = sequelize;
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/views/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/ShoppingCart-Sequelize/views/.DS_Store
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/ShoppingCart-Sequelize/views/partials/navbar.hbs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/app.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const app = express();
4 | const PORT = 4444;
5 | var hbs = require('hbs');
6 |
7 | hbs.registerPartials(__dirname + '/views/partials');
8 | app.set('view engine','hbs');
9 | app.use(express.urlencoded({extended:true}));
10 | app.use(express.static(path.join(__dirname,'public')));
11 |
12 | const adminRoute = require(path.join(__dirname,'routes','admin')).router;
13 | const shopRoute = require(path.join(__dirname,'routes','shop'));
14 | // /admin/add-product
15 | app.use('/admin',adminRoute);
16 | app.use('/',shopRoute);
17 |
18 |
19 | app.listen(PORT,()=>{
20 | console.log(`http://localhost:`+PORT);
21 | });
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/data/cart.json:
--------------------------------------------------------------------------------
1 | {"products":[{"id":"0.9945583243546856","qty":2}],"totalPrice":200}
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/data/product.json:
--------------------------------------------------------------------------------
1 | [{"id":"0.9945583243546856","name":"Nike","price":"100","description":"Superb Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"},{"id":"0.9603224872112981","name":"Reebok","price":"120","description":"Amazing Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"}]
2 |
3 |
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/index.html
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0",
14 | "mysql2": "^2.3.3",
15 | "sequelize": "^6.25.1"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/public/css/form.css:
--------------------------------------------------------------------------------
1 | .product {
2 | width: 1200px;
3 | margin: 10px;
4 | display: flex;
5 | flex-wrap: wrap;
6 | }
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/public/css/style.css:
--------------------------------------------------------------------------------
1 | .product-image{
2 | width: 200px;
3 | }
4 |
5 | .product-card{
6 | border: 1px solid black;
7 | margin: 10px;
8 | }
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/public/garbage.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/public/garbage.txt
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/routes/admin.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const adminController = require('../controllers/admin');
5 |
6 | router.get('/product-list',adminController.getProductList);
7 |
8 | router.get('/add-product',adminController.getAddProducts);
9 | router.post('/add-product',adminController.postAddProducts);
10 |
11 | router.get('/edit-product',adminController.getEditProduct);
12 | router.post('/edit-product',adminController.postEditProduct);
13 |
14 | router.post('/delete-product',adminController.postDeleteProduct);
15 |
16 | module.exports.router=router;
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/routes/shop.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const products = require('./admin').products;
5 | const shopController = require('../controllers/shop');
6 |
7 | router.get('/',shopController.getShop);
8 | router.get('/cart',shopController.getCart);
9 | router.post('/add-to-cart',shopController.postAddToCart);
10 | router.post('/delete-cart-item',shopController.postAddCartItem);
11 |
12 |
13 | module.exports=router;
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/util/database.js:
--------------------------------------------------------------------------------
1 | const mysql = require('mysql2');
2 |
3 | const pool = mysql.createPool({
4 | host: 'localhost',
5 | user: 'root',
6 | database: 'shoppingCart',
7 | password: 'KartikM@1994'
8 | });
9 |
10 | module.exports = pool.promise();
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/views/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-32(MySQL)/views/.DS_Store
--------------------------------------------------------------------------------
/Lecture-32(MySQL)/views/partials/navbar.hbs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-33(Sequelize)/.DS_Store
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/app.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const app = express();
4 | const PORT = 4444;
5 | var hbs = require('hbs');
6 | const db = require('./util/database');
7 |
8 | hbs.registerPartials(__dirname + '/views/partials');
9 | app.set('view engine','hbs');
10 | app.use(express.urlencoded({extended:true}));
11 | app.use(express.static(path.join(__dirname,'public')));
12 |
13 | const adminRoute = require(path.join(__dirname,'routes','admin')).router;
14 | const shopRoute = require(path.join(__dirname,'routes','shop'));
15 | // /admin/add-product
16 | app.use('/admin',adminRoute);
17 | app.use('/',shopRoute);
18 |
19 |
20 | db.sync().then(()=>{
21 | app.listen(PORT,()=>{
22 | console.log(`http://localhost:`+PORT);
23 | });
24 | }).catch(err=>{
25 | console.log(err);
26 | })
27 |
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/data/cart.json:
--------------------------------------------------------------------------------
1 | {"products":[{"id":"0.9945583243546856","qty":2}],"totalPrice":200}
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/data/product.json:
--------------------------------------------------------------------------------
1 | [{"id":"0.9945583243546856","name":"Nike","price":"100","description":"Superb Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"},{"id":"0.9603224872112981","name":"Reebok","price":"120","description":"Amazing Shoes!","imageUrl":"https://cdn.thisiswhyimbroke.com/images/google-sneakers1.jpg"}]
2 |
3 |
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-33(Sequelize)/index.html
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/models/product.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const path = require('path');
3 | const sequelize = require('../util/database');
4 | const Sequelize = require('sequelize');
5 |
6 | const Products = sequelize.define('products',{
7 | id:{
8 | type: Sequelize.INTEGER,
9 | allowNull: false,
10 | autoIncrement: true,
11 | primaryKey: true
12 | },
13 | name:{
14 | type: Sequelize.STRING,
15 | allowNull: false
16 | },
17 | description:{
18 | type: Sequelize.STRING,
19 | allowNull: false
20 | },
21 | price:{
22 | type: Sequelize.DOUBLE,
23 | allowNull: false
24 | },
25 | imageUrl:{
26 | type: Sequelize.STRING,
27 | allowNull: false
28 | }
29 | })
30 |
31 | module.exports = Products;
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.1",
13 | "hbs": "^4.2.0",
14 | "mysql2": "^2.3.3",
15 | "sequelize": "^6.25.1"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/public/css/form.css:
--------------------------------------------------------------------------------
1 | .product {
2 | width: 1200px;
3 | margin: 10px;
4 | display: flex;
5 | flex-wrap: wrap;
6 | }
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/public/css/style.css:
--------------------------------------------------------------------------------
1 | .product-image{
2 | width: 200px;
3 | }
4 |
5 | .product-card{
6 | border: 1px solid black;
7 | margin: 10px;
8 | }
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/public/garbage.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-33(Sequelize)/public/garbage.txt
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/routes/admin.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const adminController = require('../controllers/admin');
5 |
6 | router.get('/product-list',adminController.getProductList);
7 |
8 | router.get('/add-product',adminController.getAddProducts);
9 | router.post('/add-product',adminController.postAddProducts);
10 |
11 | router.get('/edit-product',adminController.getEditProduct);
12 | router.post('/edit-product',adminController.postEditProduct);
13 |
14 | router.post('/delete-product',adminController.postDeleteProduct);
15 |
16 | module.exports.router=router;
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/routes/shop.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const express = require('express');
3 | const router = express.Router();
4 | const products = require('./admin').products;
5 | const shopController = require('../controllers/shop');
6 |
7 | router.get('/',shopController.getShop);
8 | router.get('/cart',shopController.getCart);
9 | router.post('/add-to-cart',shopController.postAddToCart);
10 | router.post('/delete-cart-item',shopController.postAddCartItem);
11 |
12 |
13 | module.exports=router;
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/util/database.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const sequelize = new Sequelize(
3 | 'shoppingCart',
4 | 'root',
5 | 'KartikM@1994', {
6 | host: 'localhost',
7 | dialect: 'mysql'
8 | }
9 | );
10 |
11 | module.exports = sequelize;
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/views/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-33(Sequelize)/views/.DS_Store
--------------------------------------------------------------------------------
/Lecture-33(Sequelize)/views/partials/navbar.hbs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 | const path = require('path');
5 |
6 | const hbs = require('hbs');
7 | hbs.registerPartials(__dirname + '/views/partials');
8 |
9 | app.use(express.static(path.join(__dirname,'public')));
10 | app.use(express.urlencoded({extended:true}));
11 | app.set('view engine','hbs');
12 |
13 | const adminRouter = require('./routes/admin');
14 | const shopRouter = require('./routes/shop');
15 |
16 | app.use('/admin',adminRouter);
17 | app.use('/',shopRouter);
18 |
19 | app.listen(PORT,()=>{
20 | console.log(`http://localhost:${PORT}`);
21 | })
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/controller/shop.js:
--------------------------------------------------------------------------------
1 | const Product = require('../model/product');
2 |
3 | module.exports.getShop = (req,res,next)=>{
4 | Product
5 | .getAllProducts()
6 | .then(([products,fields])=>{
7 | res.render('./shop/shop',{
8 | hasProducts: products.length>0,
9 | products:products
10 | })
11 | })
12 | .catch(err=>console.log(err));
13 | }
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/data-deleted/products-deleted.js:
--------------------------------------------------------------------------------
1 | // const products = [
2 | // {name:"Reebok",price:20,description:'Amazing shoes',imageUrl:'https://images.unsplash.com/photo-1626947346165-4c2288dadc2a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTV8fHNob2V8ZW58MHx8MHx8&w=1000&q=80'},
3 | // {name:"Adidas",price:120,description:'Great shoes!!',imageUrl:'https://images.unsplash.com/photo-1626947346165-4c2288dadc2a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTV8fHNob2V8ZW58MHx8MHx8&w=1000&q=80'},
4 | // {name:"Puma",price:100,description:'New shoes in town!!',imageUrl:'https://images.unsplash.com/photo-1626947346165-4c2288dadc2a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTV8fHNob2V8ZW58MHx8MHx8&w=1000&q=80'}
5 | // ];
6 |
7 | // module.exports = products;
8 |
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2",
13 | "hbs": "^4.2.0",
14 | "mysql2": "^2.3.3"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/public/css/style.css:
--------------------------------------------------------------------------------
1 | .flexbox{
2 | display: flex;
3 | flex-wrap: wrap;
4 | }
5 |
6 | .product-image{
7 | height: 120px;
8 | }
9 |
10 | .product{
11 | /* height: 250px; */
12 | border: 1px solid black;
13 | width: 200px;
14 | margin:10px;
15 | }
16 |
17 | .myform{
18 | width: 50%;
19 | margin: auto;
20 | }
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/public/random.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-34(RevisionProject)/public/random.txt
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/routes/admin.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 |
4 | // const products = require('../data/products');
5 |
6 | const adminController = require('../controller/admin');
7 |
8 | route.get('/product-list',adminController.getProductList);
9 |
10 | route.get('/add-product',adminController.getAddProduct);
11 | route.post('/add-product',adminController.postAddProduct);
12 |
13 | route.get('/edit-product',adminController.getEditProduct);
14 | route.post('/edit-product',adminController.postEditProduct);
15 |
16 | route.get('/delete-product',adminController.getDeleteProduct);
17 |
18 |
19 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/routes/shop.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 | // const products = require('../data/products');
4 | const shopController = require('../controller/shop');
5 |
6 | route.get('/',shopController.getShop);
7 |
8 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-34(RevisionProject)/util/database.js:
--------------------------------------------------------------------------------
1 | const mysql = require('mysql2');
2 |
3 | // Create the connection pool. The pool-specific settings are the defaults
4 | const pool = mysql.createPool({
5 | host: 'localhost',
6 | user: 'root',
7 | database: 'newShoppingCart',
8 | password: 'KartikM@1994'
9 | });
10 |
11 | module.exports = pool.promise();
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/controller/shop.js:
--------------------------------------------------------------------------------
1 | const Products = require('../model/product');
2 |
3 | module.exports.getShop = (req,res,next)=>{
4 | console.log("Inside shop",req.user);
5 | Products
6 | .findAll()
7 | .then((products)=>{
8 | res.render('./shop/shop',{
9 | hasProducts: products.length>0,
10 | products:products
11 | })
12 | })
13 | .catch(err=>console.log(err));
14 | }
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/model/product.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const db = require('../util/database');
3 |
4 | const Products = db.define('products',{
5 | id:{
6 | type: Sequelize.INTEGER,
7 | allowNull: false,
8 | autoIncrement: true,
9 | primaryKey: true
10 | },
11 | name: {
12 | type: Sequelize.STRING,
13 | allowNull: false
14 | },
15 | price: {
16 | type: Sequelize.DOUBLE,
17 | allowNull: false
18 | },
19 | description:{
20 | type: Sequelize.STRING,
21 | allowNull: false
22 | },
23 | imageUrl: {
24 | type: Sequelize.STRING
25 | }
26 | })
27 |
28 | module.exports = Products;
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/model/user.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const sequelize = require('../util/database');
3 |
4 | const User = sequelize.define('users',{
5 | id:{
6 | type: Sequelize.INTEGER,
7 | primaryKey: true,
8 | autoIncrement: true,
9 | allowNull: false,
10 | },
11 | name:{
12 | type: Sequelize.STRING,
13 | allowNull: false
14 | },
15 | email:{
16 | type: Sequelize.STRING,
17 | allowNull: false
18 | }
19 | })
20 |
21 | module.exports = User;
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2",
13 | "hbs": "^4.2.0",
14 | "mysql2": "^2.3.3",
15 | "sequelize": "^6.25.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/public/css/style.css:
--------------------------------------------------------------------------------
1 | .flexbox{
2 | display: flex;
3 | flex-wrap: wrap;
4 | }
5 |
6 | .product-image{
7 | height: 120px;
8 | }
9 |
10 | .product{
11 | /* height: 250px; */
12 | border: 1px solid black;
13 | width: 200px;
14 | margin:10px;
15 | }
16 |
17 | .myform{
18 | width: 50%;
19 | margin: auto;
20 | }
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/public/random.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-35(Revision-Sequelize)/public/random.txt
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/routes/admin.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 |
4 | // const products = require('../data/products');
5 |
6 | const adminController = require('../controller/admin');
7 |
8 | route.get('/product-list',adminController.getProductList);
9 |
10 | route.get('/add-product',adminController.getAddProduct);
11 | route.post('/add-product',adminController.postAddProduct);
12 |
13 | route.get('/edit-product',adminController.getEditProduct);
14 | route.post('/edit-product',adminController.postEditProduct);
15 |
16 | route.get('/delete-product',adminController.getDeleteProduct);
17 |
18 |
19 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/routes/shop.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 | // const products = require('../data/products');
4 | const shopController = require('../controller/shop');
5 |
6 | route.get('/',shopController.getShop);
7 |
8 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-35(Revision-Sequelize)/util/database.js:
--------------------------------------------------------------------------------
1 | const { Sequelize } = require('sequelize');
2 |
3 | const sequelize = new Sequelize(
4 | 'newShoppingCart',
5 | 'root',
6 | 'KartikM@1994', {
7 | host: 'localhost',
8 | dialect: 'mysql'
9 | });
10 |
11 | module.exports = sequelize;
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/model/cart-item.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const sequelize = require('../util/database');
3 |
4 | const cartItem = sequelize.define('cartItem',{
5 | id:{
6 | type:Sequelize.INTEGER,
7 | allowNull: false,
8 | autoIncrement: true,
9 | primaryKey: true
10 | },
11 | quantity:{
12 | type:Sequelize.INTEGER,
13 | allowNull: false
14 | }
15 | })
16 |
17 | module.exports = cartItem;
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/model/cart.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const sequelize = require('../util/database');
3 |
4 | const Cart = sequelize.define('cart',{
5 | id:{
6 | type:Sequelize.INTEGER,
7 | allowNull: false,
8 | autoIncrement: true,
9 | primaryKey: true
10 | }
11 | })
12 |
13 | module.exports = Cart;
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/model/product.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const db = require('../util/database');
3 |
4 | const Products = db.define('products',{
5 | id:{
6 | type: Sequelize.INTEGER,
7 | allowNull: false,
8 | autoIncrement: true,
9 | primaryKey: true
10 | },
11 | name: {
12 | type: Sequelize.STRING,
13 | allowNull: false
14 | },
15 | price: {
16 | type: Sequelize.DOUBLE,
17 | allowNull: false
18 | },
19 | description:{
20 | type: Sequelize.STRING,
21 | allowNull: false
22 | },
23 | imageUrl: {
24 | type: Sequelize.STRING
25 | }
26 | })
27 |
28 | module.exports = Products;
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/model/user.js:
--------------------------------------------------------------------------------
1 | const Sequelize = require('sequelize');
2 | const sequelize = require('../util/database');
3 |
4 | const User = sequelize.define('users',{
5 | id:{
6 | type: Sequelize.INTEGER,
7 | primaryKey: true,
8 | autoIncrement: true,
9 | allowNull: false,
10 | },
11 | name:{
12 | type: Sequelize.STRING,
13 | allowNull: false
14 | },
15 | email:{
16 | type: Sequelize.STRING,
17 | allowNull: false
18 | }
19 | })
20 |
21 | module.exports = User;
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shoppingcart",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2",
13 | "hbs": "^4.2.0",
14 | "mysql2": "^2.3.3",
15 | "sequelize": "^6.25.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/public/css/style.css:
--------------------------------------------------------------------------------
1 | .flexbox{
2 | display: flex;
3 | flex-wrap: wrap;
4 | }
5 |
6 | .product-image{
7 | height: 120px;
8 | }
9 |
10 | .product{
11 | /* height: 250px; */
12 | border: 1px solid black;
13 | width: 200px;
14 | margin:10px;
15 | }
16 |
17 | .myform{
18 | width: 50%;
19 | margin: auto;
20 | }
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/public/random.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-36(Revision-Sequelize-2)/public/random.txt
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/routes/admin.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 |
4 | // const products = require('../data/products');
5 |
6 | const adminController = require('../controller/admin');
7 |
8 | route.get('/product-list',adminController.getProductList);
9 |
10 | route.get('/add-product',adminController.getAddProduct);
11 | route.post('/add-product',adminController.postAddProduct);
12 |
13 | route.get('/edit-product',adminController.getEditProduct);
14 | route.post('/edit-product',adminController.postEditProduct);
15 |
16 | route.get('/delete-product',adminController.getDeleteProduct);
17 |
18 |
19 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/routes/shop.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 | // const products = require('../data/products');
4 | const shopController = require('../controller/shop');
5 |
6 | route.get('/',shopController.getShop);
7 | route.get('/get-cart',shopController.getCart);
8 | route.post('/add-to-cart',shopController.postAddToCart);
9 |
10 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-36(Revision-Sequelize-2)/util/database.js:
--------------------------------------------------------------------------------
1 | const { Sequelize } = require('sequelize');
2 |
3 | const sequelize = new Sequelize(
4 | 'newShoppingCart',
5 | 'root',
6 | 'KartikM@1994', {
7 | host: 'localhost',
8 | dialect: 'mysql'
9 | });
10 |
11 | module.exports = sequelize;
--------------------------------------------------------------------------------
/Lecture-37(MongoDB)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-37(MongoDB)/delete.js:
--------------------------------------------------------------------------------
1 | const { MongoClient } = require('mongodb');
2 | const DB_URL = 'mongodb://localhost:27017';
3 |
4 | const client = new MongoClient(DB_URL);
5 | async function main() {
6 |
7 | await client.connect();
8 | console.log('Connected successfully to server');
9 | const db = client.db('myDB');
10 | const collection = db.collection('students');
11 | const data = await collection.deleteOne({name:"Dhruv"});
12 | console.log(data);
13 | return 'done.';
14 | }
15 |
16 | main()
17 | .then(()=>console.log('done'))
18 | .catch((err)=>console.log(err))
19 | .finally(()=> client.close())
--------------------------------------------------------------------------------
/Lecture-37(MongoDB)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "learnmongo",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "mongodb": "^4.11.0"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Lecture-37(MongoDB)/read.js:
--------------------------------------------------------------------------------
1 | const { MongoClient } = require('mongodb');
2 | const DB_URL = 'mongodb://localhost:27017';
3 |
4 | const client = new MongoClient(DB_URL);
5 | async function main() {
6 |
7 | await client.connect();
8 | console.log('Connected successfully to server');
9 | const db = client.db('myDB');
10 | const collection = db.collection('students');
11 | const data = await collection.find({}).toArray();
12 | console.log(data);
13 | return 'done.';
14 | }
15 |
16 | main()
17 | .then(()=>console.log('done'))
18 | .catch((err)=>console.log(err))
19 | .finally(()=> client.close())
--------------------------------------------------------------------------------
/Lecture-37(MongoDB)/write.js:
--------------------------------------------------------------------------------
1 | const { MongoClient } = require('mongodb');
2 | const DB_URL = 'mongodb://localhost:27017';
3 |
4 | const client = new MongoClient(DB_URL);
5 | async function main() {
6 |
7 | await client.connect();
8 | console.log('Connected successfully to server');
9 | const db = client.db('myDB');
10 | const collection = db.collection('students');
11 |
12 | let data = await collection.insertMany([
13 | {name:'Arvind',hobby:'Coding',age: 23},
14 | {name:'Rishabh',hobby:'Driving',age: 20},
15 | {name:'Ritik',hobby:'Netflix',age: 2221},
16 | {name:'Sid',hobby:'PC Gaming',age: 24}
17 | ]);
18 |
19 | console.log(data);
20 | return 'done.';
21 | }
22 |
23 | main()
24 | .then(()=>console.log('done'))
25 | .catch((err)=>console.log(err))
26 | .finally(()=> client.close())
--------------------------------------------------------------------------------
/Lecture-38(Sockets)/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-38(Sockets)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatapp",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2",
13 | "hbs": "^4.2.0",
14 | "socket.io": "^4.5.3",
15 | "socket.io-client": "^4.5.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-39(Cookies)/.DS_Store
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Cookies/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 |
5 | app.set('view engine','hbs');
6 | app.use(express.urlencoded({extended:true}));
7 |
8 | const loginRouter = require('./routes/login');
9 | const profileRouter = require('./routes/profile');
10 | app.use('/',loginRouter);
11 | app.use('/profile',profileRouter);
12 |
13 |
14 |
15 | app.listen(PORT,()=>{
16 | console.log('http://localhost:'+PORT);
17 | })
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Cookies/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mycode",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2",
13 | "hbs": "^4.2.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Cookies/routes/login.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 |
4 | route.get('/', (req, res, next) => {
5 | res.setHeader('Set-Cookie', 'fun=false');
6 | res.render('login');
7 | });
8 |
9 | route.get('/fun', (req, res, next) => {
10 | // console.log(req.get('Cookie'));
11 | const funAllowedHai = req.get('Cookie').split('=').pop();
12 | if (funAllowedHai == 'true')
13 | return res.send('Done ! Inside fun');
14 | res.redirect('/');
15 | })
16 |
17 | // route.post('/login',(req,res,next)=>{
18 |
19 | // })
20 |
21 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Cookies/routes/profile.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 |
4 |
5 |
6 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Cookies/views/login.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Cookies/views/profile.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 | My Profile
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Sessions/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Sessions/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mycode",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "connect-mongodb-session": "^3.1.1",
13 | "express": "^4.18.2",
14 | "express-session": "^1.17.3",
15 | "hbs": "^4.2.0"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Sessions/routes/login.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 |
4 | route.get('/', (req, res, next) => {
5 | req.session.funAllowedHai = true;
6 | res.render('login');
7 | });
8 |
9 |
10 | route.get('/fun', (req, res, next) => {
11 | let funAllowedHai = req.session.funAllowedHai;
12 | // console.log(req.session);
13 | // if (funAllowedHai == true)
14 | return res.render('profile',{
15 | funAllowedHai: funAllowedHai
16 | });
17 | // res.redirect('/');
18 | })
19 |
20 | // route.post('/login',(req,res,next)=>{
21 |
22 | // })
23 |
24 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Sessions/routes/profile.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const route = express.Router();
3 |
4 | route.get('/',(req,res)=>{
5 | let funAllowedHai;
6 | console.log("Profile page after logout");
7 | if(req.session){
8 |
9 | funAllowedHai = req.session.funAllowedHai;
10 | }
11 | res.render('profile',{
12 | funAllowedHai: funAllowedHai
13 | });
14 | })
15 |
16 | module.exports = route;
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Sessions/views/login.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Lecture-39(Cookies)/Sessions/views/profile.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 | My Profile
13 | {{#if funAllowedHai}}
14 | Poora Access Available hai
15 | {{/if}}
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Lecture-4/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-4/.DS_Store
--------------------------------------------------------------------------------
/Lecture-4/LearningCSS/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-4/LearningCSS/.DS_Store
--------------------------------------------------------------------------------
/Lecture-4/LearningCSS/img/img1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-4/LearningCSS/img/img1.jpg
--------------------------------------------------------------------------------
/Lecture-4/LearningCSS/img/img2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-4/LearningCSS/img/img2.jpg
--------------------------------------------------------------------------------
/Lecture-4/LearningCSS/img/img3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-4/LearningCSS/img/img3.jpg
--------------------------------------------------------------------------------
/Lecture-4/LearningCSS/img/kartik.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-4/LearningCSS/img/kartik.png
--------------------------------------------------------------------------------
/Lecture-4/LearningCSS/notes.txt:
--------------------------------------------------------------------------------
1 | - Resolving conflicts between elements
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/WiredTiger:
--------------------------------------------------------------------------------
1 | WiredTiger
2 | WiredTiger 10.0.2: (December 21, 2021)
3 |
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/WiredTiger.lock:
--------------------------------------------------------------------------------
1 | WiredTiger lock file
2 |
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/WiredTiger.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/WiredTiger.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/WiredTigerHS.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/WiredTigerHS.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/_mdb_catalog.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/_mdb_catalog.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-0--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-0--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-10--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-10--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-12--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-12--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-15--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-15--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-16--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-16--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-2--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-2--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-20--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-20--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-23--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-23--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-4--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-4--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/collection-7--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/collection-7--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/diagnostic.data/metrics.2022-11-19T09-06-29Z-00000:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/diagnostic.data/metrics.2022-11-19T09-06-29Z-00000
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-1--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-1--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-11--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-11--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-13--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-13--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-14--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-14--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-17--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-17--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-18--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-18--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-19--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-19--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-21--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-21--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-22--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-22--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-24--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-24--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-3--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-3--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-5--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-5--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-6--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-6--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-8--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-8--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/index-9--6943186233444725672.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/index-9--6943186233444725672.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/journal/WiredTigerLog.0000000001:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/journal/WiredTigerLog.0000000001
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/journal/WiredTigerPreplog.0000000001:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/journal/WiredTigerPreplog.0000000001
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/journal/WiredTigerPreplog.0000000002:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/journal/WiredTigerPreplog.0000000002
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/mongod.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/mongod.lock
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/sizeStorer.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-40(Passport)/data/sizeStorer.wt
--------------------------------------------------------------------------------
/Lecture-40(Passport)/data/storage.bson:
--------------------------------------------------------------------------------
1 | r storage d engine wiredTiger options ? directoryPerDB directoryForIndexes groupCollections
--------------------------------------------------------------------------------
/Lecture-40(Passport)/database.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 | const { Schema } = mongoose;
3 | const connection = mongoose.connect('mongodb://localhost:27017/mydb');
4 |
5 | const UserSchema = new Schema({
6 | username: String,
7 | password: String
8 | })
9 |
10 | const Users = mongoose.model('Users',UserSchema);
11 |
12 | module.exports = Users;
--------------------------------------------------------------------------------
/Lecture-40(Passport)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "myauth",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "connect-mongodb-session": "^3.1.1",
13 | "express": "^4.18.2",
14 | "express-session": "^1.17.3",
15 | "hbs": "^4.2.0",
16 | "mongoose": "^6.7.2",
17 | "passport": "^0.6.0",
18 | "passport-local": "^1.0.0"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Lecture-40(Passport)/passport.js:
--------------------------------------------------------------------------------
1 | const passport = require('passport');
2 | const LocalStrategy = require('passport-local').Strategy;
3 | const User = require('./database');
4 |
5 | passport.use(new LocalStrategy(
6 | function (username, password, done) {
7 | User.findOne({ username: username }, function (err, user) {
8 | if (err) { return done(err); }
9 | if (!user) { return done(null, false); }
10 | console.log(user);
11 | return done(null, user);
12 | });
13 | }
14 | ));
15 |
16 | passport.serializeUser(function (user, done) {
17 | done(null, user.id);
18 | });
19 |
20 | passport.deserializeUser(function (id, done) {
21 | User.findById(id, function (err, user) {
22 | done(err, user);
23 | });
24 | });
25 |
26 | module.exports = passport;
--------------------------------------------------------------------------------
/Lecture-40(Passport)/views/profile.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 | {{username}}
11 |
12 | Logout
13 |
14 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/.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 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-41(ReactJS)/learn-react/public/favicon.ico
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-41(ReactJS)/learn-react/public/logo192.png
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-41(ReactJS)/learn-react/public/logo512.png
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/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 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 |
3 | function App() {
4 | return (
5 |
6 |
7 |
This is my first para
8 |
9 |
10 |
This is another para
11 |
12 |
13 | );
14 | }
15 |
16 | export default App;
17 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/src/components/Person.css:
--------------------------------------------------------------------------------
1 | .person{
2 | border: 2px solid black;
3 | margin: auto;
4 | width: 320px;
5 | box-shadow: 2px 2px 5px black;
6 | }
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/src/components/Person.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import './Person.css'
3 |
4 | const Person = (props) => {
5 |
6 | return (
7 |
8 |
Name: {props.name}
9 |
Age: {props.age}
10 |
color: {props.color}
11 |
12 | )
13 | }
14 |
15 | // const Person = () => {
16 | // return (
17 | //
18 | //
Name: Kunal
19 | //
Age: 21
20 | //
color: Green
21 | //
22 | // )
23 | // }
24 |
25 | export default Person
26 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/src/components/Todolist.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const taskList = [
4 | {
5 | name: 'Cricket',
6 | isCompleted: false
7 | },
8 | {
9 | name: 'Coding',
10 | isCompleted: true
11 | },
12 | {
13 | name: 'Development',
14 | isCompleted: false
15 | },
16 | {
17 | name: 'Dancing',
18 | isCompleted: true
19 | }
20 | ];
21 |
22 | const Todolist = () => {
23 | return (
24 |
25 | {
26 | taskList.map((task) => {
27 | return
28 | {task.name}
29 |
30 |
31 | })
32 | }
33 |
34 | )
35 | }
36 |
37 | export default Todolist
38 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/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 |
--------------------------------------------------------------------------------
/Lecture-41(ReactJS)/learn-react/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 Person from './components/Person';
6 | import JsxLearn from './components/JsxLearn';
7 | import Todolist from './components/Todolist';
8 |
9 | const root = ReactDOM.createRoot(document.getElementById('root'));
10 | root.render(
11 |
12 | {/*
*/}
13 | {/*
*/}
14 |
15 |
16 |
17 | {/*
18 |
19 |
20 |
21 |
*/}
22 |
23 | );
24 |
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/.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 |
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-42(ReactJS)/forms-demo/public/favicon.ico
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-42(ReactJS)/forms-demo/public/logo192.png
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-42(ReactJS)/forms-demo/public/logo512.png
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/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 |
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/App.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-42(ReactJS)/forms-demo/src/App.css
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import Person from './Person';
3 | import Navbar from './Navbar';
4 | import ShoppingList from './components/ShoppingList';
5 |
6 | function App() {
7 | return (
8 |
9 |
10 |
11 | {/*
12 | This is a para inside closing tag of person
13 | This is heading inside the person closing tag
14 |
15 |
16 |
17 |
18 |
19 |
*/}
20 |
21 | );
22 | }
23 |
24 | export default App;
25 |
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/Person.css:
--------------------------------------------------------------------------------
1 | .person{
2 | border: 2px solid black;
3 | padding: 16px;
4 | margin: 10px auto;
5 | box-shadow: 2px 2px 2px black;
6 | font-size: 24px;
7 | width: 220px;
8 | }
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/Person.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './Person.css';
3 |
4 | const Person = (props) => {
5 |
6 | return (
7 |
8 |
Name: {props.name}
9 | {props.children}
10 |
Age: {props.age}
11 |
Color: {props.color}
12 |
13 | )
14 | }
15 |
16 | export default Person;
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/components/Counter.js:
--------------------------------------------------------------------------------
1 | import React,{useState} from 'react'
2 |
3 | const Counter = () => {
4 | const [count,setCount] = useState(0);
5 | // let count = 0;
6 | const countHandler = ()=>{
7 | // count = count + 1;
8 | setCount(count+1);
9 | // console.log(count);
10 | }
11 | return (
12 |
13 |
Count: {count}
14 |
15 |
16 | )
17 | }
18 |
19 | export default Counter
20 |
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/components/Form.css:
--------------------------------------------------------------------------------
1 | .form{
2 | border: 2px solid black;
3 | font-size: 24px;
4 | width: 360px;
5 | margin: auto;
6 | padding: 16px;
7 | }
8 |
9 | .form input{
10 | display: block;
11 | font-size: 24px;
12 | }
13 |
14 | .form input,label{
15 | margin: 10px;
16 | }
17 |
18 | .form button{
19 | font-size: 24px;
20 | }
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/components/Product.css:
--------------------------------------------------------------------------------
1 | .product{
2 | width: 360px;
3 | padding: 20px;
4 | margin: 10px auto;
5 | border: 2px solid grey;
6 | font-size: 24px;
7 | text-align: center;
8 | font-weight: bold;
9 | /* display: inline-block;
10 | height: 400px; */
11 | }
12 |
13 | .product img{
14 | width: 100%;
15 | }
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/components/Product.js:
--------------------------------------------------------------------------------
1 | import React,{useState} from 'react'
2 | import './Product.css';
3 |
4 | const Product = (props) => {
5 | // let price = props.price;
6 | const [price,setPrice] = useState(props.price);
7 |
8 | const clickHandler = ()=>{
9 | console.log('Clicked');
10 | // price = 200;
11 | setPrice(200);
12 | console.log(price);
13 | }
14 |
15 | return (
16 |
17 |

18 |
Name: {props.name}
19 |
Price: ${price}
20 |
21 | )
22 | }
23 |
24 | export default Product;
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/src/components/ShoppingList.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-42(ReactJS)/forms-demo/src/components/ShoppingList.css
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/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 |
--------------------------------------------------------------------------------
/Lecture-42(ReactJS)/forms-demo/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 ShoppingList from './components/ShoppingList';
6 | import Counter from './components/Counter';
7 |
8 | const root = ReactDOM.createRoot(document.getElementById('root'));
9 | root.render(
10 |
11 | {/*
*/}
12 | {/*
*/}
13 |
14 |
15 | //
16 | );
17 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-43(ReactJS)/.DS_Store
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/.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 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-43(ReactJS)/hooks/public/favicon.ico
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-43(ReactJS)/hooks/public/logo192.png
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-43(ReactJS)/hooks/public/logo512.png
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/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 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import PlayList from './components/PlayList';
3 | import Toggle from './components/Toggle';
4 | import useToggle from './hooks/useToggle';
5 |
6 | function App() {
7 | const [showPlaylist,changePlaylistDisplay] = useToggle(true);
8 |
9 | return (
10 |
11 |
12 | {showPlaylist &&
}
13 |
16 |
17 | );
18 | }
19 |
20 | export default App;
21 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/src/components/PlayList.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const PlayList = () => {
4 | return (
5 |
9 | Playlist
10 |
11 | )
12 | }
13 |
14 | export default PlayList
15 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/src/components/Toggle.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import useToggle from '../hooks/useToggle'
3 |
4 | const Toggle = () => {
5 | const [isHappy,changeEmotion] = useToggle(true);
6 |
7 | return (
8 | { changeEmotion() }}>
9 | {isHappy ?
😊
:
😔
}
10 |
11 | )
12 | }
13 |
14 | // const Toggle = () => {
15 | // const [toggle, setToggle] = useState(true);
16 |
17 | // return (
18 | // { setToggle(!toggle) }}>
19 | // {toggle ?
😊
:
😔
}
20 | //
21 | // )
22 | // }
23 | export default Toggle;
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/src/hooks/useToggle.js:
--------------------------------------------------------------------------------
1 | import React,{useState} from 'react'
2 |
3 | const useToggle = (initialVal) => {
4 | const [toggle, setToggle] = useState(initialVal);
5 |
6 | const changeToggleHandler = ()=>{
7 | setToggle(!toggle);
8 | }
9 |
10 | return [toggle,changeToggleHandler];
11 | }
12 |
13 | export default useToggle;
14 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/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 |
--------------------------------------------------------------------------------
/Lecture-43(ReactJS)/hooks/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 |
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 | );
11 |
12 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/.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 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-44-ReactJS/todoapp/public/favicon.ico
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-44-ReactJS/todoapp/public/logo192.png
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-44-ReactJS/todoapp/public/logo512.png
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/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 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/App.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-44-ReactJS/todoapp/src/App.css
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import Todo from './components/Todo/Todo';
3 | import TodoApp from './components/TodoApp/TodoApp';
4 |
5 | function App() {
6 | return (
7 |
8 |
Todo List
9 |
10 |
11 | );
12 | }
13 |
14 | export default App;
15 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/components/Form/Form.module.css:
--------------------------------------------------------------------------------
1 | .form{
2 | background-color: rgb(130, 4, 180);
3 | color: whitesmoke;
4 | font-weight: 800;
5 | padding: 16px;
6 | width: 360px;
7 | margin: auto;
8 | }
9 |
10 | .form button{
11 | float: right;
12 | }
13 |
14 | .form input{
15 | width: 250px;
16 | }
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/components/Todo/Todo.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import classes from './Todo.module.css'
3 | import {FaTrashAlt} from 'react-icons/fa';
4 |
5 | const Todo = (props) => {
6 | const deleteHandler = ()=>{
7 | props.deleteTodo(props.id);
8 | }
9 | return (
10 |
11 | {props.markDone(props.id)}}
15 | >
16 | {props.task}
17 |
18 |
19 | )
20 | }
21 |
22 | export default Todo
23 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/components/Todo/Todo.module.css:
--------------------------------------------------------------------------------
1 | .list-item{
2 | margin: 2px 0;
3 | padding: 16px;
4 | border: 2px solid white;
5 | background-color: rgb(130, 4, 180);
6 | color: white;
7 | font-weight: 800;
8 | }
9 |
10 | .floatRight{
11 | float: right;
12 | }
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/components/TodoApp/TodoApp.module.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-44-ReactJS/todoapp/src/components/TodoApp/TodoApp.module.css
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/components/TodoList/TodoList.js:
--------------------------------------------------------------------------------
1 | import React,{useState} from 'react';
2 | import Todo from '../Todo/Todo';
3 | import classes from './TodoList.module.css';
4 |
5 | const TodoList = (props) => {
6 | let todos = props.todos
7 | return (
8 |
9 | {
10 | todos.map((todo)=>{
11 | return (
12 |
20 | )
21 | })
22 | }
23 |
24 | )
25 | }
26 |
27 | export default TodoList
28 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/src/components/TodoList/TodoList.module.css:
--------------------------------------------------------------------------------
1 | .ul{
2 | width: 360px;
3 | padding: 16px;
4 | margin: 0 auto;
5 | list-style: none;
6 | }
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/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 |
--------------------------------------------------------------------------------
/Lecture-44-ReactJS/todoapp/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 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 | //
9 |
10 | //
11 | );
12 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/backend/apis/foodapi.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 | const mongoose = require('mongoose');
4 | const Food = require('../model/db');
5 | mongoose.connect(
6 | 'mongodb://localhost:27017/myfoodapp-17dec'
7 | ).then(()=>{
8 | console.log('DB Connected');
9 | }).catch((e)=>{
10 | console.log(e);
11 | })
12 |
13 | router.get('/getAllFood',async (req,res,next)=>{
14 | const food = await Food.find({});
15 | console.log(food);
16 | res.status(200).json(food);
17 | })
18 |
19 | router.post('/storeFood',async(req,res,next)=>{
20 |
21 | })
22 |
23 | module.exports = router;
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/backend/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const cors = require('cors');
4 |
5 | app.use(cors());
6 | app.use('/',require('./apis/foodapi'));
7 |
8 | app.listen(4444,()=>{
9 | console.log('server started at 4444');
10 | })
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/backend/model/db.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 |
3 | const FoodSchema = new mongoose.Schema({
4 | name:{
5 | type: String,
6 | required: true
7 | },
8 | price:{
9 | type: Number
10 | },
11 | review:{
12 | type: String
13 | }
14 | })
15 |
16 | const Food = mongoose.model('Food',FoodSchema);
17 | module.exports = Food;
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "project",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "cors": "^2.8.5",
13 | "express": "^4.18.2",
14 | "mongoose": "^6.8.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/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 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-45(ReactJS)/myapp/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-45(ReactJS)/myapp/frontend/public/logo192.png
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-45(ReactJS)/myapp/frontend/public/logo512.png
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/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 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/src/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import FoodList from './components/FoodList';
3 |
4 | function App() {
5 | return (
6 |
7 |
8 |
9 | );
10 | }
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/src/components/Food.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const Food = ({food}) => {
4 | return (
5 |
6 |
Name: {food.name}, Price: {food.price}, Review: {food.review}
7 |
8 | )
9 | }
10 |
11 | export default Food
12 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/frontend/src/components/FoodList.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react'
2 | import Food from './Food';
3 |
4 | const FoodList = () => {
5 | const [foods, setFoods] = useState([]);
6 |
7 |
8 | useEffect(() => {
9 | fetch('http://localhost:4444/getAllFood')
10 | .then((res) => res.json())
11 | .then((data) => {
12 | console.log(data);
13 | setFoods(data);
14 | })
15 | }, []);
16 |
17 | return (
18 | foods.map((food)=>{
19 | return
20 | })
21 | )
22 | }
23 |
24 | export default FoodList
25 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/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 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/myapp/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 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 |
9 | );
10 |
11 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/.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 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-45(ReactJS)/router-demo/public/favicon.ico
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-45(ReactJS)/router-demo/public/logo192.png
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-45(ReactJS)/router-demo/public/logo512.png
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/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 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/src/App.css:
--------------------------------------------------------------------------------
1 | .nav{
2 | width: 100%;
3 | border: 2px solid black;
4 | display: inline-block;
5 | color: white;
6 | background-color: teal;
7 | }
8 |
9 | .nav-item{
10 | cursor: pointer;
11 | display: inline-block;
12 | padding: 16px;
13 | margin: 5px;
14 | }
15 |
16 | .nav-item:hover{
17 | text-decoration: underline;
18 | }
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/src/components/About.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const About = () => {
4 | return (
5 |
6 | This is about our Team
7 |
8 | )
9 | }
10 |
11 | export default About
12 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/src/components/Courses.js:
--------------------------------------------------------------------------------
1 | import React, { Fragment } from 'react'
2 |
3 | const Courses = () => {
4 | return (
5 |
6 |
7 | This is our courses.
8 |
9 |
10 | - CPP
11 | - Java
12 | - Python
13 | - Data Science
14 | - Web Dev
15 |
16 |
17 | )
18 | }
19 |
20 | export default Courses
21 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/src/components/Home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const Home = () => {
4 | return (
5 |
6 |
This is my home page
7 |
8 | )
9 | }
10 |
11 | export default Home
12 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/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 |
--------------------------------------------------------------------------------
/Lecture-45(ReactJS)/router-demo/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 {
6 | BrowserRouter
7 | } from "react-router-dom";
8 |
9 |
10 | const root = ReactDOM.createRoot(document.getElementById('root'));
11 | root.render(
12 |
13 |
14 |
15 | );
16 |
--------------------------------------------------------------------------------
/Lecture-46(TestingFramework)/Tests/fare_test.js:
--------------------------------------------------------------------------------
1 | const calculateFare = require('../fare');
2 | const {expect} = require('chai');
3 |
4 | describe('fare_test',()=>{
5 | it('fare should be 80 for 5km, 20min',()=>{
6 | let fare = calculateFare(5,20);
7 | expect(fare).to.be.a('number');
8 | expect(fare).to.equal(80);
9 | })
10 | it('fare should be 190 for 10km, 50min',()=>{
11 | let fare = calculateFare(10,50);
12 | expect(fare).to.be.a('number');
13 | expect(fare).to.equal(280);
14 | })
15 | it('fare should be 25 for 1km, 10min',()=>{
16 | let fare = calculateFare(1,10);
17 | expect(fare).to.be.a('number');
18 | expect(fare).to.equal(25);
19 | })
20 | })
--------------------------------------------------------------------------------
/Lecture-46(TestingFramework)/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const app = express();
3 | const PORT = 4444;
4 |
5 | const calculateFare = require('./fare');
6 |
7 | app.get('/hello',(req,res)=>{
8 | res.send('hello');
9 | })
10 |
11 | app.get('/fare',(req,res)=>{
12 | let fare = calculateFare(req.query.km,req.query.min);
13 | // console.log(fare);
14 | res.send(''+fare);
15 | })
16 |
17 | module.exports = app;
18 | // app.listen(PORT,()=>{
19 | // console.log('http://localhost:'+PORT);
20 | // })
--------------------------------------------------------------------------------
/Lecture-46(TestingFramework)/fare.js:
--------------------------------------------------------------------------------
1 | // minimum to pay: 25, after 2 kms paise lagenge(10/km)
2 | // time: 15min se upar 5/min
3 | function calculateFare(km, mi) {
4 | let fare = 25;
5 | if (km > 2) fare += (km - 2) * 10
6 | if (mi > 15) fare += (mi - 15) * 5;
7 | return fare;
8 | }
9 |
10 | module.exports = calculateFare;
--------------------------------------------------------------------------------
/Lecture-46(TestingFramework)/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "testingframework",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "app.js",
6 | "scripts": {
7 | "test": "mocha tests"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "axios": "^1.2.1",
13 | "express": "^4.18.2"
14 | },
15 | "devDependencies": {
16 | "chai": "^4.3.7",
17 | "mocha": "^10.2.0"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Lecture-5/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-5/.DS_Store
--------------------------------------------------------------------------------
/Lecture-5/Transforms/img/img.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-5/Transforms/img/img.jpeg
--------------------------------------------------------------------------------
/Lecture-5/Transforms/img/kartik.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-5/Transforms/img/kartik.jpg
--------------------------------------------------------------------------------
/Lecture-6/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-6/.DS_Store
--------------------------------------------------------------------------------
/Lecture-6/TeamCards/img/img.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-6/TeamCards/img/img.jpeg
--------------------------------------------------------------------------------
/Lecture-6/TeamCards/img/kartik.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-6/TeamCards/img/kartik.jpg
--------------------------------------------------------------------------------
/Lecture-6/mediaQueries/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-6/mediaQueries/.DS_Store
--------------------------------------------------------------------------------
/Lecture-6/mediaQueries/img/img.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-6/mediaQueries/img/img.jpeg
--------------------------------------------------------------------------------
/Lecture-6/mediaQueries/img/kartik.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-6/mediaQueries/img/kartik.jpg
--------------------------------------------------------------------------------
/Lecture-7/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/.DS_Store
--------------------------------------------------------------------------------
/Lecture-7/Animations/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Animations
8 |
9 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/.DS_Store
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/Image/Comiccon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/Image/Comiccon.jpg
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/Image/Jason.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/Image/Jason.jpg
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/Image/Mark.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/Image/Mark.jpg
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/Image/Michael.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/Image/Michael.jpg
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/Image/Nidhi.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/Image/Nidhi.jpg
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/Image/Ryan.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/Image/Ryan.jpg
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/Image/Sergio.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/Image/Sergio.jpg
--------------------------------------------------------------------------------
/Lecture-7/Bootstrap/style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-7/Bootstrap/style.css
--------------------------------------------------------------------------------
/Lecture-8-Git/file1.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Kartik-Mathur/WebDev19June2022/47008f81a9828df628e798df44d58d2152087999/Lecture-8-Git/file1.txt
--------------------------------------------------------------------------------
/Lecture-9/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
12 |
13 |
14 | Learning JS!
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WebDev19June2022
2 |
--------------------------------------------------------------------------------