Task 16: Introduction to Axios β The Superhero of HTTP Requests and Install the AWS CLI on Windows| How to Download & Set Up AWS CLI v2
Start with Affirmationβ
- "I am destined for greatness. Every step I take brings me closer to my goals. I embrace challenges, knowing they are stepping stones to success. My mind is focused, my heart is determined, and my actions are aligned with my dreams."
Daily Affirmations for Success
- β I am capable, confident, and unstoppable.
- β Success flows to me because I take consistent action.
- β I attract opportunities that align with my purpose.
- β My hard work and persistence create abundance.
- β I am always learning, growing, and evolving.
- β I believe in my potential and trust my journey.
- β I turn setbacks into comebacks with resilience.
- β I am grateful for every success, big and small.
Success Reflectionβ
"Every effort I made today has planted seeds for my future success. I release any doubts and trust the process. My dreams are possible, and I am getting closer every day. I am grateful, I am strong, and I am ready for more!"
πͺ Repeat daily, feel the power, and watch your success unfold!
Task Answer - Video Linkβ
πΉ If you donβt understand the task, watch the video above for the answer.
Taskβ
β What Axios is β How to make a GET request β How to handle .then() and .catch() β How to POST data β How Axios is different from fetch()
** Step 1: What is Axios?β
Axios is a JavaScript library that helps you make HTTP requests β like getting data from an API or sending info to a server."
π§ It works in the browser and in Node.js. Itβs like fetch(), but easier and with more features built-in.
π‘ We can include it in CodePen like this:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
Step1β
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Create New User with Axios</title>
</head>
<body>
<h1>π€ Create New User</h1>
<button id="createUserBtn">Create User</button>
<h2 id="resultHeading" style="display: none;">β
New User Created:</h2>
<p><strong>Name:</strong> <span id="userName"></span></p>
<p><strong>Email:</strong> <span id="userEmail"></span></p>
<!-- Axios CDN -->
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<!-- Link to JS file -->
<script src="script.js"></script>
</body>
</html>
Step 2β
// Get HTML elements
const createUserBtn = document.getElementById("createUserBtn");
const userNameSpan = document.getElementById("userName");
const userEmailSpan = document.getElementById("userEmail");
const resultHeading = document.getElementById("resultHeading");
// When button is clicked, create new user
createUserBtn.addEventListener("click", () => {
const newUser = {
name: "Enoch",
email: "[email protected]"
};
axios.post("https://jsonplaceholder.typicode.com/users", newUser)
.then(response => {
const user = response.data;
console.log("π€ New User Created:", user);
// Show data on the page
userNameSpan.textContent = user.name;
userEmailSpan.textContent = user.email;
resultHeading.style.display = "block";
})
.catch(error => {
console.error("π« Error sending data:", error);
alert("Oops! Something went wrong while creating the user.");
});
});
Taskβ
Install the AWS CLI on Windows | How to Download & Set Up AWS CLI v2β
** Step 1: What is AWS CLI?β
The AWS Command Line Interface lets you control AWS services from your terminal or command prompt. Instead of clicking in the AWS Console, you can type commands and automate tasks β pretty cool, right?
Step 2: Download the Installerβ
First, go to the official AWS CLI download page."
π Open your browser and go to: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
Scroll to the Windows section and click the .msi installer link for 64-bit (most common).
Step 3: Run the Installerβ
"Once itβs downloaded, double-click the .msi file to start the installer."
π§ Follow the steps:
Click Next
Accept the License Agreement β
Choose default install location
Click Install
Click Finish when done
You may need admin rights to install.
Step 4: Verify Installationβ
Now letβs check if it installed correctly.
Open Command Prompt (Search 'cmd' in Start menu)
Type this command:
aws --version
Step 5: Configure AWS CLI (Optional for Later Use)β
If you have your AWS credentials ready, you can set them up using:
aws configure
It will ask you for:
AWS Access Key ID
AWS Secret Access Key
Default region name (like us-east-1)
Output format (json, text, or table)
Done! You're ready to use AWS CLI.
You've just installed and set up the AWS CLI on Windows. Now you can start using commands to manage your AWS services.