Add Student Management mini system

Express + MySQL CRUD API for student records, with a plain HTML frontend.

- Single-file backend (server.js) with 5 CRUD routes
- Proper HTTP status codes and a consistent error envelope
- 8-digit ids: 2-digit year + per-year 6-digit counter (e.g. 26000001),
  allocated under a MySQL advisory lock so concurrent inserts cannot collide
- student_db.sql schema and seed data
- .env for credentials; only .env.example is committed
This commit is contained in:
2026-09-28 18:58:42 +08:00
parent 36ef7f0122
commit 45e4de3557
8 changed files with 1783 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
-- student_db schema and seed data.
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
SET NAMES utf8mb4;
DROP TABLE IF EXISTS `students`;
CREATE TABLE `students` (
`id` int NOT NULL,
`name` varchar(100) NOT NULL,
`course` varchar(50) NOT NULL,
`year_level` int NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Ids are a 2-digit year + a per-year counter, so these two were added in 2026.
-- The app assigns ids, so there is no AUTO_INCREMENT here.
INSERT INTO `students` (`id`, `name`, `course`, `year_level`) VALUES
(26000001, 'Juan Dela Cruz', 'BSIT', 2),
(26000002, 'Maria Santos', 'BSCS', 3);
COMMIT;