Skip to content

cisdevoe/lab_crud_api_3isc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 Student Records API (Express.js + MySQL)

A RESTful API for managing student records, built with Express.js and MySQL.
This project demonstrates CRUD operations, routing, controllers, and testing with Postman.
Extended activity includes an additional courses resource with full CRUD.


🚀 Features

  • Full CRUD (Create, Read, Update, Delete) for students
  • RESTful routes & controller structure
  • MySQL integration using mysql2
  • Environment configuration via .env
  • CORS enabled for frontend access
  • Tested with Postman
  • Supplemental: courses table with full CRUD

⚙️ Setup & Installation

  1. Clone & install dependencies

    git clone <repo-url>
    cd lab-crud-api
    npm install
  2. Create .env file: DB_HOST=localhost DB_USER=root DB_PASS= DB_NAME=lab_crud PORT=3000

  3. Create database and tables:

CREATE DATABASE lab_crud;

CREATE TABLE students ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, email VARCHAR(100) NOT NULL, course VARCHAR(50), year_level INT );

CREATE TABLE courses ( id INT AUTO_INCREMENT PRIMARY KEY, code VARCHAR(50) UNIQUE NOT NULL, title VARCHAR(100), units INT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );

  1. Run server npm run dev

API Endpoints Students

  • GET /api/students → List all students

  • GET /api/students/:id → Get student by ID

  • POST /api/students → Create new student

  • PUT /api/students/:id → Update student

  • DELETE /api/students/:id → Delete student

    Courses (Supplemental)

  • GET /api/courses → List all courses

  • GET /api/courses/:id → Get course by ID

  • POST /api/courses → Create new course

  • PUT /api/courses/:id → Update course

  • DELETE /api/courses/:id → Delete course

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published