Full Stack Practical Test (1 Hour)
Task Title
Simple To-Do App with Backend
Objective
Build a web application using HTML, CSS, JavaScript, and [Link] where users can add and view
tasks.
Time Limit
1 Hour
Requirements
1. Create UI with input and button 2. Send data using fetch API 3. Store tasks in backend 4. Display
tasks on UI
Evaluation Criteria
Functionality (10 marks) Code Quality (5 marks) UI Design (5 marks) Bonus Features (5 marks)
Folder Structure
project/ [Link] public/ [Link] [Link] [Link]
Backend Code ([Link])
const express = require("express");
const app = express();
const PORT = 3000;
[Link]([Link]());
[Link]([Link]("public"));
let tasks = [];
[Link]("/tasks", (req, res) => {
[Link]([Link]);
[Link]({ message: "Task added" });
});
[Link]("/tasks", (req, res) => {
[Link](tasks);
});
[Link](PORT, () => {
[Link](`Server running on [Link]
});
Frontend HTML ([Link])
<!DOCTYPE html>
<html>
<head>
<title>To-Do App</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<div class="container">
<h2>To-Do List</h2>
<input type="text" id="taskInput" placeholder="Enter task">
<button onclick="addTask()">Add</button>
<ul id="taskList"></ul>
</div>
<script src="[Link]"></script>
</body>
</html>
CSS ([Link])
body {
font-family: Arial;
display: flex;
justify-content: center;
margin-top: 100px;
}
.container {
text-align: center;
}
button:hover {
background-color: lightgray;
}
JavaScript ([Link])
async function addTask() {
const input = [Link]("taskInput");
const task = [Link];
await fetch("/tasks", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: [Link]({ task })
});
[Link] = "";
loadTasks();
}
async function loadTasks() {
const res = await fetch("/tasks");
const tasks = await [Link]();
const list = [Link]("taskList");
[Link] = "";
[Link](t => {
const li = [Link]("li");
[Link] = t;
[Link](li);
});
}
loadTasks();
Bonus Tasks
1. Add delete button 2. Prevent empty input 3. Improve UI 4. Add timestamp