[go: up one dir, main page]

0% found this document useful (0 votes)
74 views62 pages

Node.js Manual for Web Development

The document outlines a skill development course focused on Node.js, React.js, and Django for B.Tech students. It includes course objectives, outcomes, and a series of practical exercises aimed at building web applications, implementing server-side programming, and utilizing databases. Additionally, it provides sample HTML, CSS, and JavaScript code for developing a shopping cart web application with responsive design using Bootstrap.

Uploaded by

smilysrij12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views62 pages

Node.js Manual for Web Development

The document outlines a skill development course focused on Node.js, React.js, and Django for B.Tech students. It includes course objectives, outcomes, and a series of practical exercises aimed at building web applications, implementing server-side programming, and utilizing databases. Additionally, it provides sample HTML, CSS, and JavaScript code for developing a shopping cart web application with responsive design using Bootstrap.

Uploaded by

smilysrij12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NODE JS manual

Computer Science and Engineering (Jawaharlal Nehru Technological


University, Hyderabad)
22AI305PC: SKILL DEVELOPMENT COURSE (NODE JS/
REACT JS/ DJANGO)
[Link]. II Year I Sem. LTPC

0 0 21

Prerequisites: Object Oriented Programming through Java, HTML Basics

Course Objectives:
● To implement the static web pages using HTML and do client side validation usingJavaScript.
● To design and work with databases usingJava
● To develop an end to end application using java fullstack.
● To introduce Node JS implementation for server sideprogramming.
● To experiment with single page application development usingReact.

Course Outcomes: At the end of the course, the student will be able to,

● Build a custom website with HTML, CSS, and Bootstrap and littleJavaScript.
● Demonstrate Advanced features of JavaScript and learn aboutJDBC
● Develop Server – side implementation using Java technologieslike
● Develop the server – side implementation using NodeJS.
● Design a Single Page Application usingReact.

Exercises:

1. Build a responsive web application for shopping cart with registration, login,
catalog and cart pages using CSS3 features, flex andgrid.
2. Make the above web application responsive web application using Bootstrapframework.
3. UseJavaScriptfordoingclient–sidevalidation
ofthepagesimplementedinexperiment1and experiment2.
4. Explore the features of ES6 like arrow functions, callbacks, promises,
async/await. Implement an application for reading the weather information from
[Link] and display the information in the form of a graph on the
webpage.
5. Develop a java stand alone application that connects with the database (Oracle /
mySql) and perform the CRUD operation on the databasetables.
6. Create an xml for the bookstore. Validate the same using both DTD andXSD.
7. Design a controller with servlet that provides the interaction with application
developed in experiment 1 and the database created in experiment5.
8. Maintaining the transactional history of any user is very important. Explore the
various session tracking mechanism (Cookies, HTTPSession)
9. Create a custom server using http module and explore the other modules of Node
JS like OS, path,event.
10. Develop an express web application that can interact with REST API to perform
CRUD operations on student data. (UsePostman)
11. For the above application create authorized end points using JWT (JSON WebToken).
12. Create a react application for the student management system having registration,
login, contact, about pages and implement routing to navigate through thesepages.
13. Create a service in react that fetches the weather information from
[Link] and the display the current and historical weather information
using graphical representation using [Link]
14. Create a TODO application in react with necessary components and deploy it intogithub.

REFERENCE BOOKS:
1. Jon Duckett, Beginning HTML, XHTML, CSS, and JavaScript, Wrox Publications,2010
2. BryanBasham,KathySierraandBertBates,HeadFirstServletsandJSP,O’ReillyMedia,2nd
Edition,2008.
3. Vasan Subramanian, Pro MERN Stack, Full Stack Web App Development with
Mongo, Express, React, and Node, 2nd Edition, APress.
1. Build a response web application for shopping cart with registration cart with
registration ,login, catalog, and cart pages using CSS3 features, flex and grid.

Registration file

<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="[Link]">Catalog </a></li>
<li><a href="[Link]">Login</a></li>
<li><a href="[Link]">Register</a></li>
</ul>
</nav>
</header>
<main>
<section class="register-section">
<h2>Register</h2>
<form>
<input type="text" placeholder="Username" required>
<input type="email" placeholder="Email" required>
<input type="password" placeholder="Password" required>
<button type="submit">Register</button>
</form>
</section>
</main>
<script src="[Link]"></script>
</body>
</html
Login page
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="[Link]">Catalog </a></li>
<li><a href="[Link]">Login</a></li>
<li><a href="[Link]">Register</a></li>
</ul>
</nav>
</header>
<main>
<section class="login-section">
<h2>Login</h2>
<form>
<input type="email" placeholder="Email" required>
<input type="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
</section>
</main>
<script src="[Link]"></script>
</body>
</html>

Index page

<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="[Link]">Catalog </a></li>
<li><a href="[Link]">Login</a></li>
<li><a href="[Link]">Register</a></li>
</ul>
</nav>
</header>
<main>
<section class="catalog">
<!-- Products will be dynamically generated here -->
</section>
<aside class="cart">
<h2>Shopping Cart</h2>
<div class="cart-items">
<!-- Cart items will be displayed here -->
</div>
<div class="cart-summary">
<p>Total: $<span id="totalAmount">0.00</span></p>
<button onclick="checkout()">Checkout</button>
</div>
</aside>
</main>
<script src="[Link]"></script>
</body>
</html>

Stylesheet page
[Link]
/* General styles */
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
color: #333;
}
header {
background-color: #333;
color: #fff;
padding: 15px;
text-align: right;
}
nav ul {
list-style: none;
padding: 0;
margin: 0;
}
nav ul li {
display: inline;
margin-right: 20px;
}
nav ul li a {
color: #fff;
text-decoration: none;
}
/* Main content styles */
main {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px;
}
/* Catalog styles */
.catalog {
flex: 1 70%;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
padding: 20px;
}
.product-card {
background-color: #fff;
padding: 15px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
}
.product-card:hover {
transform: translateY(-5px);
}
.product-card h3 {
margin: 0;
font-size: 18px;
color: #333;
}
.product-card p {
margin-top: 10px;
font-size: 16px;
}
.product-card button {
display: block;
width: 100%;
padding: 8px 0;
margin-top: 10px;
color: #fff;
background-color: #333;
border: none;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.3s;
}

.product-card button:hover {
background-color: #555;
}
/* Cart styles */
.cart {
flex: 1 30%;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
}
.cart h2 {
margin-top: 0;
font-size: 24px;
color: #333;
}
.cart-items {
max-height: 400px;
overflow: auto;
}
.cart-summary {
margin-top: 20px;
text-align: right;
}
.cart-summary p {
font-size: 18px;
margin: 5px 0;
}
.cart-summary button {
padding: 10px 20px;
background-color: #333;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.3s;
}
.cart-summary button:hover {
background-color: #555;
}
/* Responsive styles */
@media (max-width: 768px) {
main {
flex-direction: column;
}
.cart {
margin-top: 20px;
}
}
/* General styles */
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
color: #333;
}
/* Header styles */
header {
background-color: #333;
color: #fff;
padding: 15px;
text-align: right;
}
nav ul {
list-style: none;
padding: 0;
margin: 0;
}
nav ul li {
display: inline;
margin-right: 20px;
}
nav ul li a {
color: #fff;
text-decoration: none;
}
/* Main content styles */
main {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px;
}
/* Login and Register Section styles */
.login-section,
.register-section {
flex: 1 45%;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
h2 {
margin-top: 0;
font-size: 24px;
color: #333;
}
form {
display: flex;
flex-direction: column;
}
input {
padding: 10px;
margin: 8px 0;
border-radius: 3px;
border: 1px solid #ccc;
}
button {
padding: 10px;
background-color: #333;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #555;
}

[Link]

// Mock data for products


const products = [
{ id: 1, name: "Product 1", price: 10.99 },
{ id: 2, name: "Product 2", price: 19.99 },
// Add more products as needed
];

// Cart to store added items


var cart = [];

// Function to display products in the catalog


function displayCatalog() {
const catalogSection = [Link]('.catalog');

[Link](product => {
const productCard = [Link]('div');
[Link]('product-card');
[Link] = `
<h3>${[Link]}</h3>
<p>$${[Link]}</p>
<button onclick="addToCart(${[Link]})">Add to Cart</button>
`;
[Link](productCard);
});
}

// Function to add items to the cart


function addToCart(productId) {
const selectedProduct = [Link](product => [Link] === productId);

[Link](selectedProduct); // Add the selected product to the cart


updateCartDisplay();
}

// Function to update the cart display


function updateCartDisplay() {
const cartItemsContainer = [Link]('.cart-items');
[Link] = ''; // Clear the previous items in the cart

let totalAmount = 0;

[Link](item => {
const cartItem = [Link]('div');
[Link] = `<p>${[Link]} - $${[Link]}</p>`;
[Link](cartItem);

totalAmount += [Link];
});

const totalAmountDisplay = [Link]('totalAmount');


[Link] = [Link](2); // Update the total amount in the cart
}

// Function to handle the checkout process


function checkout() {
cart = []; // Clear the cart
updateCartDisplay();
alert('Thank you for your purchase!');
}
// Display the catalog when the page loads
[Link] = displayCatalog;

OUTPUT:

2. Make the above web application responsive web application using


Bootstrap frame work.

[Link]
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet"
href="[Link]
</head>
<body>
<header class="bg-dark">
<nav class="navbar navbar-expand navbar-dark">
<a class="navbar-brand mr-5" href="[Link]">Shopping Cart</a>
<a href="[Link]" class="btnbtn-light mr-5">Login</a>
<a href="[Link]" class="btnbtn-light mr-5">Register</a>
</nav>
</header>
<main class="container mt-4">
<section class="catalog row">
<!-- Products will be dynamically generated here -->
</section>
<aside class="cart bg-light p-3">
<h2>Shopping Cart</h2>
<div class="cart-items">
<!-- Cart items will be displayed here -->
</div>
<div class="cart-summary">
<p>Total: $<span id="totalAmount">0.00</span></p>
<button onclick="checkout()" class="btnbtn-dark">Checkout</button>
</div>
</aside>
</main>
<script src="[Link]"></script>
<script src="[Link]
</body>
</html>

Login [Link]
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet"
href="[Link]
<link rel="stylesheet" href="[Link]">
</head>
<body>
<header class="bg-dark">
<nav class="navbar navbar-expand navbar-dark">
<a class="navbar-brand mr-5" href="[Link]">Shopping Cart</a>
<a href="[Link]" class="btnbtn-light mr-5">Login</a>
<a href="[Link]" class="btnbtn-light mr-5">Register</a>
</nav>
</header>
<main class="container mt-4">
<section class="login-section bg-light p-3">
<h2>Login</h2>
<form>
<input type="email" placeholder="Email" required class="form-control">
<input type="password" placeholder="Password" required class="form-control">
<button type="submit" class="btnbtn-dark">Login</button>
</form>
</section>
</main>
<script src="[Link]
</body>
</html>
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet"
href="[Link]
<link rel="stylesheet" href="[Link]">
</head>

<body>
<header class="bg-dark">
<nav class="navbar navbar-expand navbar-dark">
<a class="navbar-brand mr-5" href="[Link]">Shopping Cart</a>
<a href="[Link]" class="btnbtn-light mr-5">Login</a>
<a href="[Link]" class="btnbtn-light mr-5">Register</a>
</nav>
</header>
<main class="container mt-4">
<section class="login-section bg-light p-3">
<h2>Login</h2>
<form>
<input type="text" placeholder="Username" required class="form-control">
<input type="email" placeholder="Email" required class="form-control">
<input type="password" placeholder="Password" required class="form-control">
<button type="submit" class="btnbtn-dark">Login</button>
</form>
</section>
</main>
<script src="[Link]
</body>
</html>

[Link]

// Mock data for products


const products = [
{ id: 1, name: "Product 1", price: 10.99 },
{ id: 2, name: "Product 2", price: 19.99 },
// Add more products as needed
];
// Cart to store added items
var cart = [];
// Function to display products in the catalog
function displayCatalog() {
const catalogSection = [Link]('.catalog');
[Link](product => {
const productCard = [Link]('div');
[Link]('product-card');
[Link] = `
<h3>${[Link]}</h3>
<p>$${[Link]}</p>
<button onclick="addToCart(${[Link]})">Add to Cart</button>
`;
[Link](productCard);
});
}
// Function to add items to the cart
function addToCart(productId) {
const selectedProduct = [Link](product => [Link] === productId);
[Link](selectedProduct); // Add the selected product to the cart
updateCartDisplay();
}
// Function to update the cart display
function updateCartDisplay() {
const cartItemsContainer = [Link]('.cart-items');
[Link] = ''; // Clear the previous items in the cart
let totalAmount = 0;
[Link](item => {
const cartItem = [Link]('div');
[Link] = `<p>${[Link]} - $${[Link]}</p>`;
[Link](cartItem);
totalAmount += [Link];
});
const totalAmountDisplay = [Link]('totalAmount');
[Link] = [Link](2); // Update the total amount in the cart
}
// Function to handle the checkout process
function checkout() {
cart = []; // Clear the cart
updateCartDisplay();
alert('Thank you for your purchase!');
}
// Display the catalog when the page loads
[Link] = displayCatalog;
3. Use JavaScript for doing client-side validation of the pages
implemented in experiment1 and experiment2.

[Link]
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="[Link]">Catalog </a></li>
<li><a href="[Link]">Login</a></li>
<li><a href="[Link]">Register</a></li>
</ul>
</nav>
</header>
<main>
<section class="register-section">
<h2>Register</h2>
<form id="registrationForm">
<input type="text" id="username" placeholder="Username" required>
<input type="email" id="email" placeholder="Email" required>
<input type="password" id="password" placeholder="Password" required>
<input type="text" id="fullName" placeholder="Full Name" required>
<button type="submit">Register</button>
</form>
</section>
</main>
<script>
// Mock data for products
const products = [
{ id: 1, name: "Product 1", price: 10.99 },
{ id: 2, name: "Product 2", price: 19.99 },
// Add more products as needed
];

// Cart to store added items


var cart = [];
// Function to display products in the catalog
function displayCatalog() {
const catalogSection = [Link]('.catalog');

[Link](product => {
const productCard = [Link]('div');
[Link]('product-card');
[Link] = `
<h3>${[Link]}</h3>
<p>$${[Link]}</p>
<button onclick="addToCart(${[Link]})">Add to Cart</button>
`;
[Link](productCard);
});
}
// Function to add items to the cart
function addToCart(productId) {
const selectedProduct = [Link](product => [Link] === productId);

[Link](selectedProduct); // Add the selected product to the cart


updateCartDisplay();
}
// Function to update the cart display
function updateCartDisplay() {
const cartItemsContainer = [Link]('.cart-items');
[Link] = ''; // Clear the previous items in the cart
let totalAmount = 0;

[Link](item => {
const cartItem = [Link]('div');
[Link] = `<p>${[Link]} - $${[Link]}</p>`;
[Link](cartItem);

totalAmount += [Link];
});
const totalAmountDisplay = [Link]('totalAmount');
[Link] = [Link](2); // Update the total amount in the cart
}
// Function to handle the checkout process
function checkout() {
cart = []; // Clear the cart
updateCartDisplay();
alert('Thank you for your purchase!');
}
// Display the catalog when the page loads
[Link] = displayCatalog;
const form = [Link]('registrationForm');
[Link]('submit', function (event) {
[Link]();
if (validateForm()) {
// Submit the form
[Link]();
}
});
function validateForm() {
const username = [Link]('username').value;
const email = [Link]('email').value;
const password = [Link]('password').value;
const fullName = [Link]('fullName').value;

// Validation logic
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const passwordRegex = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/;

if ([Link]< 4) {
alert('Username must be at least 4 characters');
return false;
}
if (![Link](email)) {
alert('Please enter a valid email address');
return false;
}
if (![Link](password)) {
alert('Password must contain at least 8 characters, including one uppercase letter, one lowercase
letter, and one number');
return false;
}

if ([Link](' ').length< 2) {
alert('Please enter your full name');
return false;
}
return true;
}
</script>
</body>
</html>

[Link]
/* General styles */
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
color: #333;
}

/* Header styles */
header {
background-color: #333;
color: #fff;
padding: 15px;
text-align: right;
}

nav ul {
list-style: none;
padding: 0;
margin: 0;
}

nav ul li {
display: inline;
margin-right: 20px;
}

nav ul li a {
color: #fff;
text-decoration: none;
}
/* Main content styles */
main {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px;
}
/* Catalog styles */
.catalog {
flex: 1 70%;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
padding: 20px;
}
.product-card {
background-color: #fff;
padding: 15px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
}

.product-card:hover {
transform: translateY(-5px);
}
.product-card h3 {
margin: 0;
font-size: 18px;
color: #333;
}

.product-card p {
margin-top: 10px;
font-size: 16px;
}
.product-card button {
display: block;
width: 100%;
padding: 8px 0;
margin-top: 10px;
color: #fff;
background-color: #333;
border: none;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.3s;
}
.product-card button:hover {
background-color: #555;
}

/* Cart styles */
.cart {
flex: 1 30%;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
}
.cart h2 {
margin-top: 0;
font-size: 24px;
color: #333;
}
.cart-items {
max-height: 400px;
overflow: auto;
}
.cart-summary {
margin-top: 20px;
text-align: right;
}

.cart-summary p {
font-size: 18px;
margin: 5px 0;
}
.cart-summary button {
padding: 10px 20px;
background-color: #333;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.3s;
}

.cart-summary button:hover {
background-color: #555;
}
/* Responsive styles */
@media (max-width: 768px) {
main {
flex-direction: column;
}

.cart {
margin-top: 20px;
}
}

/* General styles */
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
color: #333;
}

/* Header styles */
header {
background-color: #333;
color: #fff;
padding: 15px;
text-align: right;
}

nav ul {
list-style: none;
padding: 0;
margin: 0;
}

nav ul li {
display: inline;
margin-right: 20px;
}

nav ul li a {
color: #fff;
text-decoration: none;
}

/* Main content styles */


main {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px;
}

/* Login and Register Section styles */


.login-section,
.register-section {
flex: 1 45%;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}

h2 {
margin-top: 0;
font-size: 24px;
color: #333;
}
form {
display: flex;
flex-direction: column;
}
input {
padding: 10px;
margin: 8px 0;
border-radius: 3px;
border: 1px solid #ccc;
}
button {
padding: 10px;
background-color: #333;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #555;
}

4. Explore the features of ES6 like arrow functions, callbacks,


promises, async/await. Implement an application for reading the
weather information from [Link] and display the
information in the form of a graph on the webpage.

[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Weather Graph</title>
<style>
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
max-width: 800px;
margin: 20px auto;
text-align: center;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
margin-bottom: 20px;
color: #333;
}
.weather-info {
display: flex;
flex-direction: column;
align-items: center;
}
.weather-details {
margin-bottom: 20px;
text-align: left;
}
#temperature,
#humidity {
font-weight: bold;
}
#weatherChart {
max-width: 100%;
margin-top: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="container">
<h1>Weather Graph</h1>
<div class="weather-info">
<div class="weather-details">
<p>City: <span id="city"></span></p>
<p>Temperature: <span id="temperature"></span>°C</p>
<p>Humidity: <span id="humidity"></span>%</p>
</div>
</div>
</div>
<script>
const city = 'Amangal';
const fetchWeatherData = async () => {
const apiKey = '55182a39ac895d7589769018264e680c';
try {
const response = await fetch(`[Link]
{city}&cnt=8&appid=${apiKey}&units=metric`);
const data = await [Link]();
return [Link](item => ({ date: item.dt_txt, temperature: [Link],
humidity: [Link] }));
} catch (error) {
[Link]('Error fetching weather data:', error);
}
};
const createWeatherGraph = async () => {
const weatherData = await fetchWeatherData();
if (weatherData) {
const dates = [Link](item =>[Link]);
const temperatures = [Link](item =>[Link]);
const humidity = [Link](item =>[Link]);
[Link]('temperature').innerText = temperatures[0];
[Link]('humidity').innerText = humidity[0];
[Link]('city').innerText = city;
}
};
createWeatherGraph();
</script>
</body>
</html>
5. Develop a java stand alone application that connects with the database
(Oracle / mySql) and perform the CRUD operation on the database tables.

MySQL Code:

sql> CREATE TABLE IF NOT EXISTS student (


s_id INT PRIMARY KEY,
s_nameVARCHAR(255),
s_addressVARCHAR(255)
);

Java Code
[Link]

import [Link].*;
import [Link];

public class InsertData {


public static void main(String[] args) {
try (Connection con = [Link]("jdbc:mysql://localhost/mydb",
"root", "");
Statements = [Link]()) {

Scanner sc = new Scanner([Link]);


[Link]("Inserting Data into student table:");
[Link](" ");

[Link]("Enter student id: ");


int sid = [Link]();
[Link]("Enter student name: ");
String sname = [Link]();
[Link]("Enter student address: ");
String saddr = [Link]();

String insertQuery = "INSERT INTO student VALUES(" + sid + ",'" + sname + "','" +
saddr + "')";
[Link](insertQuery);

[Link]("Data inserted successfully into student table");

} catch (SQLException err) {


[Link]("ERROR: " + err);
}
}
}

Output:
Inserting Data into student table:

Enter student id: 101


Enter student name: John Doe
Enter student address: 123 Main Street
Data inserted successfully into student table

[Link]

import [Link].*;
import [Link];

public class UpdateData {


public static void main(String[] args) {
try (Connection con = [Link]("jdbc:mysql://localhost/mydb",
"root", "");
Statements = [Link]()) {
Scanner sc = new Scanner([Link]);
[Link]("Update Data in student table:");
[Link](" ");

[Link]("Enter student id: ");


int sid = [Link]();
[Link]("Enter student name: ");
String sname = [Link]();
[Link]("Enter student address: ");
String saddr = [Link]();

String updateQuery = "UPDATE student SET s_name='" + sname + "', s_address='" +


saddr + "' WHERE s_id=" + sid;
[Link](updateQuery);

[Link]("Data updated successfully");

} catch (SQLException err) {


[Link]("ERROR: " + err);
}
}
}

Output :
Update Data in student table:

Enter student id: 101


Enter student name: Jane Doe
Enter student address: 456 Broad Street
Data updated successfully

[Link]

import [Link].*;
import [Link];

public class DeleteData {


public static void main(String[] args) {
try (Connection con = [Link]("jdbc:mysql://localhost/mydb",
"root", "");
Statements = [Link]()) {

Scanner sc = new Scanner([Link]);


[Link]("Delete Data from student table:");
[Link](" ");
[Link]("Enter student id: ");
int sid = [Link]();

String deleteQuery = "DELETE FROM student WHERE s_id=" + sid;


[Link](deleteQuery);

[Link]("Data deleted successfully");

} catch (SQLException err) {


[Link]("ERROR: " + err);
}
}
}

Output :
Delete Data from student table:

Enter student id: 101


Data deleted successfully

[Link]

import [Link].*;

public class DisplayData {


public static void main(String[] args) {
try (Connection con = [Link]("jdbc:mysql://localhost/mydb",
"root", "");
Statement s = [Link]()) {

ResultSet rs = [Link]("SELECT * FROM student");


if (rs != null) {
[Link]("SID \t STU_NAME \t ADDRESS");
[Link](" ");

while ([Link]()) {
[Link]([Link]("s_id") + " \t " + [Link]("s_name") + " \t " +
[Link]("s_address"));
[Link](" ");
}
}

} catch (SQLException err) {


[Link]("ERROR: " + err);
}
}
}

Output :
SID STU_NAME ADDRESS

102 Alice Smith 789 Oak Avenue

103 Bob Johnson 567 Pine Road

6. Create an xml for the bookstore. Validate the same using both DTD
andXSD.
XML data to validate:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookstore[
<!ELEMENT bookstore (book+)>
<!ELEMENT book (title, author, price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT price (#PCDATA)>
]>
<bookstore>
<book>
<title>Introduction to XML</title>
<author>John Doe</author>
<price>29.99</price>
</book>
<book>
<title>Programming with XML</title>
<author>Jane Smith</author>
<price>39.99</price>
</book>
</bookstore>
XML schema (XSD) data:

<?xml version="1.0" encoding="UTF-8"?>


<xs:schema xmlns:xs="[Link]
targetNamespace="[Link]
xmlns="[Link]
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="bookstore" type="bookstoreType"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:complexType name="bookstoreType">
<xs:sequence>
<xs:element name="book" type="bookType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="bookType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
7. Design a controller with servlet that provides the interaction with application developed
inexperiment 1 and the database created in experiment 5.

Mysql database
Procedure:
[Link]:
<html>
<head>
<title> validation </title>
</head>
<body bgcolor="magenta">
<form action="[Link]" method="post">
<h1 align="center">REGISTRATION FORM</h1>
<table border="0">
<tr>
<td>Name:</td>
<td><input type="text" name="t1" min length="6"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="t2"></td>
</tr>
<tr>
<td>Phone number:</td>
<td><input type="text" name="t3"></td>
</tr>
<tr>
<td>E-mail id:</td>
<td><input type="text" name="t4"></td>
</tr>
<tr>
<td><input type="submit" value="submit"></td>
<td><input type="reset" value="cancel"></td>
</tr>
</table>
</form>
</body>
</html>
[Link]:
<%@ page language="java" import="[Link].*,[Link].*" %>
<html>
<form >
<%
String v1,v2,v3,v4,str;
v1=[Link]("t1");
v2=[Link]("t2");
v3=[Link]("t3");
v4=[Link]("t4");
try{
[Link]("[Link]");
Connection cn=[Link]("jdbc:odbc:oradsn","system","ravindra");
Statement st=[Link]();
[Link]("insert into register values('"+v1+"','"+v2+"',"+v3+",'"+v4+"')");
if(cn!=null)
{
%>
</form>
Registration Successful
<%
}
else
{
[Link]("Registration failed");
}
[Link]();
[Link]();
}catch(Exception e) { [Link](" Registration failed");
%>
<P><a href = "[Link]" target =f2 > <B> Back<B> </a>
<%
}
%>
</body></html>
Execution:
Create a table with name register with name (varchar2 (10)), password (varchar2 (10)),
Phone(number (10)) ,Email-ID (varchar2(10)).
Create the Data source name.
Start->settings->control panel->Administrative Tools->Data Sources.
Under SystemDSN add Microsoft ODBC for Oracle.
Set Data Source name to oradsn.

Output:
8. Maintaining the transactional history of any user is very important.
Explore the various session tracking mechanism (Cookies,
HTTPSession)
const express = require('express');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const app = express();
// Cookie Parser middleware for handling cookies
[Link](cookieParser());
// Session middleware for managing server-side sessions
[Link](session({
secret: 'mysecret', // Change this to a secure value in production
resave: false,
saveUninitialized: true,
}));
[Link]('/set-cookie', (req, res) => {
// Setting a cookie
[Link]('userId', '12345', { maxAge: 900000, httpOnly: true });
[Link]('Cookie set successfully!');
});
[Link]('/get-cookie', (req, res) => {
// Getting the value of the cookie
const userId = [Link];
[Link](User ID from cookie: ${userId});
});
[Link]('/set-session', (req, res) => {
// Setting session data
[Link] = 'JohnDoe';
[Link]('Session set successfully!');
});
[Link]('/get-session', (req, res) => {
// Getting session data
const username = [Link] || 'No username set';
[Link](Username from session: ${username});
});
[Link](3001, () => {
[Link]('Server running on port 3001');
});
9. Create a custom server using http module and explore the other
modules of Node JS like OS, path,event.

const http = require('http');

const os = require('os');

const path = require('path');

const server = [Link]((req, res) => {

if ([Link] === '/details') {

[Link](200, { 'Content-Type': 'text/html' });

// OS module information

const osInfo = `

<h1>OS Information</h1>

<p>Platform: ${[Link]()}</p>

<p>Architecture: ${[Link]()}</p>

<p>CPU Info: ${[Link]([Link]())}</p>

<p>Total Memory: ${[Link]()}</p>

<p>Free Memory: ${[Link]()}</p>

`;

// Path module information

const filePath = [Link]( dirname, 'files', '[Link]');

const parsedPath = [Link](filePath);

const pathInfo = `

<h1>Path Information</h1>

<p>File Path: ${filePath}</p>


<p>Parsed Path: ${[Link](parsedPath)}</p>

`;

// Combining OS and Path info

const combinedInfo = osInfo + pathInfo;

// Sending the HTML response

[Link](`

<!DOCTYPE html>

<html>

<head>

<title>System Details</title>

</head>

<body>

${combinedInfo}

</body>

</html>

`);

} else {

[Link](404, { 'Content-Type': 'text/plain' });

[Link]('Page Not Found');

});

const PORT = 3000;

[Link](PORT, () => {

[Link](Server running on port ${PORT});


});
10. Develop an express web application that can interact with REST
API to perform CRUD operations on student data. (UsePostman)
mkdir student-api
cd student-api
---Enter---
npminit -y
---Enter---
npm install express body-parser axios
---Enter---
gedit [Link]
---Enter---
//CODE STARTS//
const express = require('express');
constbodyParser = require('body-parser');
constaxios = require('axios');

const app = express();


const PORT = 3000;

[Link]([Link]());

// Replace this with your REST API URL


constapiUrl = '[Link]

// GET all students


[Link]('/students', async (req, res) => {
try {
const response = await [Link](apiUrl);
[Link]([Link]);
} catch (error) {
[Link](500).json({ error: [Link] });
}
});

// GET a single student by ID


[Link]('/students/:id', async (req, res) => {
try {
const{ id } = [Link];
const response = await [Link](`${apiUrl}/${id}`);
[Link]([Link]);
} catch (error) {
[Link](500).json({ error: [Link] });
}
});

// CREATE a new student


[Link]('/students', async (req, res) => {
try {
const response = await [Link](apiUrl, [Link]);
[Link]([Link]);
} catch (error) {
[Link](500).json({ error: [Link] });
}
});

// UPDATE a student by ID
[Link]('/students/:id', async (req, res) => {
try {
const{ id } = [Link];
const response = await [Link](`${apiUrl}/${id}`, [Link]);
[Link]([Link]);
} catch (error) {
[Link](500).json({ error: [Link] });
}
});

// DELETE a student by ID
[Link]('/students/:id', async (req, res) => {
try {
const{ id } = [Link];
const response = await [Link](`${apiUrl}/${id}`);
[Link]([Link]);
} catch (error) {
[Link](500).json({ error: [Link] });
}
});

[Link](PORT, () => {
[Link](`Server is running on port ${PORT}`);
});
//CODE ENDS//

node [Link]
---Enter---

INSTALL TALEND APT TESTER


[Link]

-- Create Student --
{ "name": "NewStudent", "age": Number }
11. For the above application create authorized end points using JWT (JSON
WebToken).
// npmi express body-parser jsonwebtoken
// gedit [Link]
// node [Link]
const express = require('express');
const bodyParser = require('body-parser');
const jwt = require('jsonwebtoken');

const app = express();


[Link]([Link]());
[Link]([Link]({ extended: true }));

const secretKey = 'your_secret_key'; // Replace with your own secret key

// Sample student data (temporary)


let students = [
{ id: 1, name: 'Alice', age: 20, grade: 'A' },
{ id: 2, name: 'Bob', age: 21, grade: 'B' }
];

// JWT Authorization Middleware


function authenticateToken(req, res, next) {
const token = [Link]['authorization'];

if (token === undefined) {


return [Link](401); // Unauthorized
}

[Link](token, secretKey, (err, user) => {


if (err) {
return [Link](403); // Forbidden
}
[Link] = user;
next();
});
}

// Your existing CRUD endpoints


// GET all students (public endpoint)
[Link]('/students', (req, res) => {
[Link](students);
});

// Protected endpoint example - GET all students (requires authorization)


[Link]('/students/protected', authenticateToken, (req, res) => {
// This endpoint requires a valid JWT token to access
[Link](students);
});

// POST a new student (public endpoint)


[Link]('/students', (req, res) => {
const newStudent = [Link];
[Link](newStudent);
[Link](201).send('Student added');
});

// PUT update a student's information (public endpoint)


[Link]('/students/:id', (req, res) => {
const id = [Link];
const updatedStudent = [Link];
const index = [Link](student => [Link] === parseInt(id));
if (index === -1) {
[Link](404).send('Student not found');
return;
}
students[index] = updatedStudent;
[Link]('Student updated');
});

// DELETE a student (public endpoint)


[Link]('/students/:id', (req, res) => {
const id = [Link];
students = [Link](student => [Link] !== parseInt(id));
[Link]('Student deleted');
});

// Login endpoint to generate JWT token (example - use your own logic for
authentication)[Link]('/login', (req, res) => { // In a real application, verify the
credentials const username = [Link]; const user = { username }; //
Example user const accessToken = [Link](user, secretKey);
[Link]({ accessToken });});const PORT = 3000; // You can use any available
[Link](PORT, () => { [Link]();});
Server is running on port ${PORT}
12. Create a react application for the student management system
having registration, login, contact, about pages and implement routing
to navigate through thesepages.
npm create vite@latest
./
React
JavaScript
npmi
npmi react-router-dom
delete [Link]

[Link]

import React from &#39;react&#39;


import ReactDOM from &#39;react-dom/client&#39;
import App from &#39;./[Link]&#39;
import &#39;./[Link]&#39;
import {
BrowserRouter
} from &quot;react-router-dom&quot;
[Link]([Link](&#39;root&#39;)).render(
&lt;[Link]&gt;
&lt; BrowserRouter&gt;
&lt;App /&gt;
&lt;/BrowserRouter&gt;
&lt;/[Link]&gt;,
)

[Link]

import React from &#39;react&#39;


import {Link, Routes, Route } from &#39;react-router-dom&#39;
import &#39;./[Link]&#39;
const Navbar = () =&gt; {
return (
&lt;divclassName=&#39;nav&#39;&gt;
&lt;LinkclassName=&#39;nav-item&#39; to=&#39;/&#39;&gt;Home&lt;/Link&gt;
&lt;LinkclassName=&#39;nav-item&#39;
to=&#39;/login&#39;&gt;Login&lt;/Link&gt;
&lt;LinkclassName=&#39;nav-item&#39;
to=&#39;/register&#39;&gt;Register&lt;/Link&gt;
&lt;LinkclassName=&#39;nav-item&#39;
to=&#39;/contact&#39;&gt;Contact&lt;/Link&gt;
&lt;LinkclassName=&#39;nav-item&#39;
to=&#39;/about&#39;&gt;About&lt;/Link&gt;
&lt;/div&gt;
)
}

const Home = () =&gt; {


return (
&lt;divclassName=&quot;center-div&quot;&gt;
&lt;h1&gt;Home&lt;/h1&gt;
&lt;/div&gt;
)
}
const About = () =&gt; {
return (
&lt;divclassName=&quot;center-div&quot;&gt;
&lt;h1&gt;About us &lt;/h1&gt;
&lt;/div&gt;
)
}
const Contact = () =&gt; {
return (
&lt;divclassName=&quot;center-div&quot;&gt;
&lt;h1&gt;Contact us&lt;/h1&gt;
&lt;input type=&quot;text&quot; placeholder=&quot;Enter your name&quot; /&gt;
&lt;input type=&quot;email&quot; placeholder=&quot;Enter your email&quot; /&gt;
&lt;input type=&quot;text&quot; placeholder=&quot;Enter your message&quot; /&gt;
&lt;button&gt;Submit&lt;/button&gt;
&lt;/div&gt;
)
}
const Login = () =&gt; {
return (
&lt;divclassName=&quot;center-div&quot;&gt;
&lt;h1&gt;Login&lt;/h1&gt;
&lt;input type=&quot;email&quot; placeholder=&quot;Enter your email&quot; /&gt;
&lt;input type=&quot;password&quot; placeholder=&quot;Enter your
password&quot; /&gt;
&lt;button&gt;Login&lt;/button&gt;
&lt;/div&gt;
)
}
const Register = () =&gt; {
return (
&lt;divclassName=&quot;center-div&quot;&gt;
&lt;h1&gt;Register&lt;/h1&gt;
&lt;input type=&quot;email&quot; placeholder=&quot;Enter your email&quot; /&gt;
&lt;input type=&quot;password&quot; placeholder=&quot;Enter your
password&quot; /&gt;
&lt;input type=&quot;text&quot; placeholder=&quot;Enter your name&quot; /&gt;
&lt;button&gt;Register&lt;/button&gt;
&lt;/div&gt;
)
}
const App = () =&gt; {
return (
&lt;div&gt;
&lt;Navbar/&gt;
&lt;Routes&gt;

&lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;


&lt;Route path=&quot;/login&quot; element={&lt;Login /&gt;} /&gt;
&lt;Route path=&quot;/register&quot; element={&lt;Register /&gt;} /&gt;
&lt;Route path=&quot;/contact&quot; element={&lt;Contact /&gt;} /&gt;
&lt;Route path=&quot;/about&quot; element={&lt;About /&gt;} /&gt;
&lt;/Routes&gt;
&lt;/div&gt;
)
}

export default App

[Link]
.nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
background-color: #f5f5f5;
border-bottom: 1px solid #ccc;
}
.center-div {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
input{
padding: 10px;
margin: 10px;
border-radius: 5px;
border: 1px solid #ccc;
width: 300px;
font-size: 16px;
outline: none;
}
button{
padding: 10px;
margin: 10px;
border-radius: 5px;
border: 1px solid #ccc;
background-color: #f5f5f5;
font-size: 16px;
cursor: pointer;
}

//start
npm run dev
13. Create a service in react that fetches the weather information from
[Link] and the display the current and historical
weather information using graphical representation using [Link]
npm create vite@latest
.
React
javaScript
npmi
npm install axios [Link]
import React, { useState } from &#39;react&#39;;
import Chart from &#39;[Link]/auto&#39;; // Import [Link]
import &#39;./[Link]&#39;; // Assuming you have a CSS file for styles
const WeatherApp = () =&gt; {
const [city, setCity] = useState(&#39;&#39;);
const [weatherData, setWeatherData] = useState(null);
const [error, setError] = useState(false);
const apiKey = &quot;55182a39ac895d7589769018264e680c&quot;;
const apiUrl =
&quot;[Link]
const checkWeather = async (city) =&gt; {
try {
const response = await fetch(apiUrl + city + `&amp;appid=${apiKey}`);
if ([Link] === 404) {
setError(true);
setWeatherData(null);
} else {
const data = await [Link]();
setWeatherData(data);
setError(false);
drawGraph(data); // Draw the graph once data is fetched
}
} catch (error) {
[Link](&#39;Error fetching data:&#39;, error);
}
};
const handleSearch = () =&gt; {
checkWeather(city);
};
const drawGraph = (data) =&gt; {
const ctx =
[Link](&#39;weatherGraph&#39;).getContext(&#39;2d&#39;);
new Chart(ctx, {
type: &#39;bar&#39;,
data: {
labels: [&#39;Temperature&#39;, &#39;Humidity&#39;, &#39;Wind Speed&#39;],
datasets: [{

label: &#39;Weather Information&#39;,


data: [[Link], [Link], [Link]],
backgroundColor: [
&#39;rgba(255, 99, 132, 0.2)&#39;,
&#39;rgba(54, 162, 235, 0.2)&#39;,
&#39;rgba(255, 206, 86, 0.2)&#39;,
],
borderColor: [
&#39;rgba(255, 99, 132, 1)&#39;,
&#39;rgba(54, 162, 235, 1)&#39;,
&#39;rgba(255, 206, 86, 1)&#39;,
],
borderWidth: 1,
}],
},
options: {
scales: {
y: {
beginAtZero: true,
},
},
},
});
};
return (
&lt;divclassName=&quot;card&quot;&gt;
&lt;divclassName=&quot;search&quot;&gt;
&lt;input
type=&quot;text&quot;
placeholder=&quot;Enter city name&quot;
spellCheck=&quot;false&quot;
value={city}
onChange={(e) =&gt; setCity([Link])}
/&gt;
&lt;buttononClick={handleSearch}&gt;
Search
&lt;/button&gt;
&lt;/div&gt;
{error &amp;&amp; &lt;divclassName=&quot;error&quot;&gt;&lt;p&gt;Invalid City
Name&lt;/p&gt;&lt;/div&gt;}
&lt;divclassName=&quot;weather&quot;&gt;
&lt;canvas id=&quot;weatherGraph&quot; width=&quot;400&quot;
height=&quot;400&quot;&gt;&lt;/canvas&gt;
&lt;/div&gt;
&lt;/div&gt;
);
};
export default WeatherApp;
14. Create a TODO application in react with necessary components and deploy
it intogithub.
npm create vite@latest
.
React
javaScript
npmi
import React, { useState } from &#39;react&#39;;
const styles = {
appContainer: {
maxWidth: &#39;500px&#39;,
margin: &#39;0 auto&#39;,
fontFamily: &#39;Arial, sans-serif&#39;,
},
inputContainer: {
display: &#39;flex&#39;,
marginBottom: &#39;15px&#39;,
},
inputText: {
padding: &#39;8px&#39;,
marginRight: &#39;10px&#39;,
flexGrow: &#39;1&#39;,
},
button: {
padding: &#39;8px 12px&#39;,
cursor: &#39;pointer&#39;,
},
taskList: {
listStyle: &#39;none&#39;,
padding: &#39;0&#39;,
},
taskListItem: {
marginBottom: &#39;5px&#39;,
display: &#39;flex&#39;,
alignItems: &#39;center&#39;,
},
completed: {
textDecoration: &#39;line-through&#39;,
},
deleteButton: {
marginLeft: &#39;5px&#39;,
backgroundColor: &#39;#ff6961&#39;,
color: &#39;#fff&#39;,
border: &#39;none&#39;,
borderRadius: &#39;4px&#39;,
padding: &#39;6px 10px&#39;,
cursor: &#39;pointer&#39;,
},
};

const App = () =&gt; {


const [tasks, setTasks] = useState([]);
const [inputValue, setInputValue] = useState(&#39;&#39;);
const [editIndex, setEditIndex] = useState(-1);
const [completedTasks, setCompletedTasks] = useState(new Set());
consthandleInputChange = (e) =&gt; {
setInputValue([Link]);
};
constaddTask = () =&gt; {
if ([Link]() !== &#39;&#39;) {
if (editIndex !== -1) {
constupdatedTasks = [...tasks];
updatedTasks[editIndex] = inputValue;
setTasks(updatedTasks);
setEditIndex(-1);
} else {
setTasks([...tasks, inputValue]);
}
setInputValue(&#39;&#39;);
}
};
constcompleteTask = (index) =&gt; {
constupdatedCompletedTasks = new Set(completedTasks);
if ([Link](index)) {
[Link](index);
} else {
[Link](index);
}
setCompletedTasks(updatedCompletedTasks);
};
constdeleteTask = (index) =&gt; {
constupdatedTasks = [...tasks];
[Link](index, 1);
setTasks(updatedTasks);
};
consteditTask = (index) =&gt; {
setInputValue(tasks[index]);
setEditIndex(index);
};
return (
&lt;div style={[Link]}&gt;
&lt;h1&gt;TODO List&lt;/h1&gt;
&lt;div style={[Link]}&gt;
&lt;input
type=&quot;text&quot;
value={inputValue}
onChange={handleInputChange}
placeholder=&quot;Enter a task&quot;

style={[Link]}
/&gt;
&lt;buttononClick={addTask} style={[Link]}&gt;
{editIndex !== -1 ? &#39;Update&#39; : &#39;Add Task&#39;}
&lt;/button&gt;
&lt;/div&gt;
&lt;ul style={[Link]}&gt;
{[Link]((task, index) =&gt; (
&lt;li key={index} style={{ ...[Link],
...([Link](index) &amp;&amp; [Link]) }}&gt;
&lt;spanonClick={() =&gt; completeTask(index)} style={{ flexGrow:
&#39;1&#39;, cursor: &#39;pointer&#39; }}&gt;
{task}
&lt;/span&gt;
&lt;buttononClick={() =&gt; editTask(index)}
style={[Link]}&gt;
Edit
&lt;/button&gt;
&lt;buttononClick={() =&gt; completeTask(index)}
style={[Link]}&gt;
{[Link](index) ?&#39;Mark Incomplete&#39; : &#39;Mark
Complete&#39;}
&lt;/button&gt;
&lt;buttononClick={() =&gt; deleteTask(index)}
style={[Link]}&gt;
Delete
&lt;/button&gt;
&lt;/li&gt;
))}
&lt;/ul&gt;
&lt;/div&gt;
);
};
export default App;

You might also like