Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8a70acc
added additional files
NetbotsDotTech May 15, 2024
35d6b1a
added callback , promise and async await examples
NetbotsDotTech Jun 3, 2024
ca6bbbe
Merge branch 'main' of https://github.com/NetbotsDotTech/Web-Dev-Batch-1
NetbotsDotTech Jun 3, 2024
d16f7f9
updated branch
NetbotsDotTech Jun 3, 2024
36c8856
added fetch api example
NetbotsDotTech Jun 7, 2024
10f3858
added state variable
NetbotsDotTech Jun 28, 2024
51abb20
added state variable
NetbotsDotTech Jun 28, 2024
2d4f629
added login and register form
NetbotsDotTech Aug 2, 2024
af1d3ee
update menu bar
NetbotsDotTech Aug 2, 2024
e330e5d
added data
NetbotsDotTech Aug 6, 2024
ab68ed4
added
NetbotsDotTech Aug 12, 2024
224e9a3
added multi step formik form
NetbotsDotTech Aug 14, 2024
07e87bb
updated the ui design of stepper form
NetbotsDotTech Aug 16, 2024
ba8f041
initial commit
NetbotsDotTech Sep 2, 2024
d18d9dd
configure env
NetbotsDotTech Sep 6, 2024
fba9906
added basic user schema
NetbotsDotTech Sep 9, 2024
043adbf
Added
NetbotsDotTech Sep 9, 2024
cda0f8a
added register controller
NetbotsDotTech Sep 10, 2024
d218c35
updated the register endpoint
NetbotsDotTech Sep 11, 2024
a697201
adde login enpoint
NetbotsDotTech Sep 12, 2024
0ba9b15
added
NetbotsDotTech Sep 16, 2024
cd05563
added
NetbotsDotTech Sep 16, 2024
398bcce
setup product endpoint skeletn
NetbotsDotTech Sep 18, 2024
b049343
added product controllers
NetbotsDotTech Oct 14, 2024
bd27bc3
updated the subcategory issue
NetbotsDotTech Oct 15, 2024
0353cde
added middlewares
NetbotsDotTech Oct 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions JS/AsyncAwait/AsyncAwait.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
async function DisplayData() {
let myPromise = new Promise(function(resolve, reject) {
setTimeout(() => {
resolve("Hello from Amazon Server");
}, 2000);
});
let FullfilledPromise = await myPromise;
console.log(FullfilledPromise)
}

DisplayData();
22 changes: 22 additions & 0 deletions JS/AsyncAwait/AsyncAwaitPromises.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function helloWorld() {
return new Promise((resolve )=>{
setTimeout(() => {
resolve("Succesfull")
}, 3000);

});
}
async function Fun1() {
const msg = await helloWorld();
console.log("Message from function 1:", msg);
}
async function Fun2() {
const msg = await helloWorld();
console.log("Message from function 2:", msg);
}

Fun1()
Fun2()



18 changes: 18 additions & 0 deletions JS/AsyncAwait/Asynchronous.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function DsiplayMessage() {
return new Promise((resolve) => {
setTimeout(() => {
resolve("Hello World!");
}, 2000);
});
}
const FirstFunction =async function () {
const result =await DsiplayMessage();
console.log("FirstFunction :", result);
};
const SecondFunction = async () => {
const result = await DsiplayMessage();
console.log("SecondFunction :", result);
};

FirstFunction();
SecondFunction();
14 changes: 14 additions & 0 deletions JS/AsyncAwait/TryCatch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var myObject = {
name: "John Doe",
age: 15,
email: "test@test.com",
job: "Auditor",
};
try {
let userJSON = JSON.stringify(myObject);
console.log("JSON Data" ,userJSON);
let userObj = JSON.parse(myObject);
console.log("Object Data", userObj);
} catch (e) {
console.error(`Invalid data!`);
}
7 changes: 7 additions & 0 deletions JS/AsyncAwait/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Name": "Saqlain",
"FatherName": "Zaheer"
}


<Name>Saqlain</Name>
11 changes: 11 additions & 0 deletions JS/Destructuring/Array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const [first, last] = ["Nikola", "Tesla"];



let data = ["saqlain", 70, 432423, true];
const [name, age, ...others] = data

console.log(`Name : ${name} , Age : ${age}, Other Values :${others}`)

data.push("Shah")
console.log(`Data : ${data}`)
8 changes: 8 additions & 0 deletions JS/Destructuring/Default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const data = {
username: "saqlain",
age: 70,
isMale: true,
};
console.log("My Name is ",username);


10 changes: 10 additions & 0 deletions JS/Destructuring/destructuring.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@



const numbers = [1, 2, 3, 4, 5, 6];
console.log("numbers", numbers)
const [num1, num2, ...others] = numbers;
console.log("value", ...others)
const value = [num1, num2, ...others]

console.log("value", value)
17 changes: 17 additions & 0 deletions JS/Destructuring/object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let { title, author } = {
title: "MERN Stack Course",
author: "Saqlain Shah",
};


let data = {
username:"saqlain",
Age: 70,
No:432423,
isMale: true
};
const {username, Age, ...abc} = data

console.log(`username : ${username} , Age : ${Age}, Other Values :${abc}`)

console.log(abc)
57 changes: 57 additions & 0 deletions JS/EventListner/evenyListner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<title>Event Listeners with HTML Form</title>
<script>
function handleButtonClick() {
console.log("Button clicked!");
}


function handleMouseOver() {
console.log("Mouse over the element!");
}

function handleMouseOut() {
console.log("Mouse left the element!");
}

function handleKeyDown(event) {
console.log("Key pressed:", event.key);
}

function handleKeyUp(event) {
console.log("Key released:", event.key);
}

function handleSubmit(event) {
event.preventDefault();
console.log("Form submitted!");
}
</script>
</head>
<body>
<form onsubmit="handleSubmit(event)">
<label for="myInput">Input:</label>
<input
type="text"
id="myInput"
onchange="console.log('Input value changed:', this.value)"
/>
<br />
<button onclick="handleButtonClick()">Click Me</button>
<br />
<div onmouseover="handleMouseOver()" onmouseout="handleMouseOut()">
Mouse over me
</div>
<br />
<input
type="text"
onkeydown="handleKeyDown(event)"
onkeyup="handleKeyUp(event)"
/>
<br />
<button type="submit">Submit</button>
</form>
</body>
</html>
7 changes: 7 additions & 0 deletions JS/EventListner/onchange.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const inputElement = document.getElementById("myInput");

inputElement.onchange = function () {
console.log("Input value changed");
// Perform additional actions or updates here
};

1 change: 1 addition & 0 deletions JS/EventListner/onclick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions JS/EventListner/onsubmit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

23 changes: 23 additions & 0 deletions JS/FetchApi/FetchApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const url = "www.rinor.pk/videostreaming"

fetch(url, {
method: "POST",
headers: {
"Content-type": "application/json",
apikey: apiKey,
},
body: data,

}).then(
(response) => {
if (response.ok) {
return response.json();
}
throw new Error("Request failed!");
},
(networkError) => {
console.log(networkError.message);
}
);

fetch()
5 changes: 5 additions & 0 deletions JS/FetchApi/FetchApiFunction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fetch("https://api-xyz.com/endpoint", {
method: "POST",
body: JSON.stringify({ id: "200" }),
})

8 changes: 8 additions & 0 deletions JS/FetchApi/PromiseUrlParameterFetchApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


fetch("https://jsonplaceholder.typicode.com/posts")
.then(response => response.json())
.then(response=> console.log(response))
.catch(err=>console.log(err.message))


5 changes: 5 additions & 0 deletions JS/Promises/UsingPromises.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
promise
.then()
.catch();


74 changes: 74 additions & 0 deletions JS/Promises/callback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

function fetchData(innerFunction) {
console.log("Fetching Data...!");
setTimeout(() => {
console.log("Data fetched");
innerFunction()
}, 4000);
}

function processData(innerFunction) {
console.log("Processing Data...!");
setTimeout(() => {
console.log("Data processed");
innerFunction()
}, 3000);
}

function saveData(innerFunction) {
console.log("Saving Data...!");
setTimeout(() => {
console.log("Data saved");
innerFunction()
}, 2000);
}

fetchData(()=>{
processData(()=>{
saveData(()=>{
console.log("All done!");
})
})
})








// let firstTask = (callback) => {
// console.log("Task Loading...!");

// setTimeout(() => {
// console.log("First Task");
// callback()
// }, 4000);
// }


// let SecondTask = (callback) => {
// console.log("Task Loading...!");

// setTimeout(() => {
// console.log("Second Task ");
// callback()
// }, 3000);
// }

// let ThirdTask = (callback) => {
// setTimeout(() => {
// console.log("Third Task ");
// callback()
// }, 2000);
// }

// firstTask(()=>{
// SecondTask(()=>{
// ThirdTask(()=>{
// console.log("All Done")
// })
// })

// })
73 changes: 73 additions & 0 deletions JS/Promises/callbackAlternative.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

// let firstTask = new Promise((resolve)=>{
// setTimeout(() => {
// resolve("First Task");
// resolve()
// }, 4000);
// })


// let SecondTask = new Promise((resolve)=>{
// setTimeout(() => {
// resolve("Second Task");
// }, 3000);
// })


// let ThirdTask = new Promise((resolve)=>{
// setTimeout(() => {
// resolve("Third Task");
// }, 2000);
// })


// firstTask
// .then((a)=>console.log(a))
// .then()
// .then(ThirdTask())
// .then(()=>{console.log("All Done")})


let fetchData= ()=> {
return new Promise((resolve) => {
console.log("Fetching Data...!");
setTimeout(() => {
console.log("Data fetched");
resolve();
}, 2000);
});
}

function processData() {
return new Promise((resolve) => {
console.log("Processing Data...!");
setTimeout(() => {
console.log("Data processed");
resolve();
}, 2000);
});
}

function saveData() {
return new Promise((resolve) => {
console.log("Saving Data...!");
setTimeout(() => {
console.log("Data saved");
resolve();
}, 2000);
});
}

fetchData()
.then(() => processData())
.then(() => saveData())
.then(() => {
console.log("All done!");
})
.catch((error) => {
console.error("An error occurred:", error);
});




Loading