Before you begin

Full Stack Development Lab: All Programs

Each program lists the file name, the exact command to compile/run it, and the code. Tap Copy to copy any code block. Prerequisites: Node.js 18+, Git, MySQL 8, a browser (Chrome) and VS Code.

Experiment 1: JavaScript and the DOM (basics)

Run: save both files in one folder, then open index.html in Chrome (or VS Code Live Server). Press F12, Console tab, to see output.

Setup file for 1.1, 1.2, 1.3

1.1 Link a JavaScript file with the HTML page

1.2 Select elements using selectors

1.3 Event listeners

Experiment 2: Click events and functions

Run: open index.html in the browser. To run only the functions in Node: node functions.js

2.1 Click events for button elements

2.2 Three types of functions

Experiment 3: React class and functional components

Create project (once, reused for Experiments 3 to 6):
npm create vite@latest myapp -- --template react
cd myapp then npm install then npm run dev (open the shown localhost URL).
Alternative (as in the manual): npx create-react-app myapp then npm start. Replace src/App.jsx (or App.js) with each program below.

3.1 Counter using a class component

3.2 Counter using a functional component

Experiment 4: Events, conditional rendering and string literals

Run: in myapp: npm run dev. Replace src/App.jsx with each program.

4.1 Button click event

4.2 Conditional rendering

4.3 Display text using string literals

Experiment 5: React hooks

Run: npm run dev inside myapp (needs internet for 5.2).

5.1 Counter using useState

5.2 Fetch data from an API using useEffect

Experiment 6: Props, forms and lists

Run: npm run dev inside myapp.

6.1 Two components sharing data using props

6.2 Forms in React

6.3 Iterative rendering using map()

Experiment 7: Git and GitHub (setup and basic workflow)

Run: in Terminal / Git Bash. Install Git from git-scm.com. Create an empty repo on github.com first. For the password, use a Personal Access Token (GitHub, Settings, Developer settings, Tokens).

7.1 Setup

7.2 Basic workflow

Experiment 8: Branching and collaboration

Run: inside the repository from Experiment 7.

8.1 and 8.2 Create a branch and merge it into main

8.3 Resolve a merge conflict (guided)

Experiment 9: Uploading a React project to GitHub

Run: Terminal. Create an empty GitHub repo named myapp first.

9.1 to 9.4 Create app, push, .gitignore and branches

9.5 Merge and pull requests (GitHub GUI)

Experiment 10: Node.js and Express (routing)

Setup once: mkdir expressapp && cd expressapp, npm init -y, npm install express
Run: node server.js then open http://localhost:3000 in the browser. Stop with Ctrl+C.

10.1 "Hello World" route

10.2 Small website with multiple routes

10.3 Print "Hello World" in the browser console

Experiment 11: Express CRUD and database connection

Setup: npm install express mysql2
Run: node server.js. Test with Postman or curl, e.g. curl -X POST localhost:3000/items -H "Content-Type: application/json" -d "{\"name\":\"Pen\"}"

11.1 CRUD operations using Express.js

11.2 Connect API and database using the MySQL driver

First run the SQL from Experiment 12 (create database college and table students). Change the password below.

Experiment 12: MySQL (database, tables, queries)

Run: mysql -u root -p then paste the commands. Or from a file: mysql -u root -p < exp12.sql

12.1 Create a database and a table

12.2 Create table, insert data and update data

Experiment 13: MySQL (subqueries and Workbench)

Run (13.1): mysql -u root -p college then paste the queries.
Run (13.2): open MySQL Workbench, connect to Local instance, File, New Query Tab, paste the script, save with Ctrl+S as script.sql, run with the lightning icon (Ctrl+Enter).

13.1 Subqueries

13.2 Script file in MySQL Workbench

Experiment 14: Integrating the database into the API

Project layout: project/db/init.sql, project/db/connection.js, project/server.js
Run: mysql -u root -p < db/init.sql then npm install express mysql2 then node server.js

14.1 Create database directory and initialise the .sql file

Experiment 15: Team collaboration using GitHub

Steps: Form a group of 2 to 3. One member creates the repo and adds the others under Settings, Collaborators. Everyone clones and works on their own branch.

15.1 to 15.3 Shared repo and branch workflow

15.4 Issues, Pull Requests, Code Reviews and README