Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Campuses & Students - Server

Backend for the Campuses & Students CRUD app. Pairs with the client repo.

A Campus has many Students. A Student belongs to at most one Campus, or none (unenrolled).

Stack

  • Node + Express
  • Prisma ORM
  • PostgreSQL (hosted on Neon)

Run Locally

  1. Clone this repository and move into the server folder:
cd campuses-server
  1. Install dependencies:
npm install
  1. Create a .env file in campuses-server/ with your database connection string:
DATABASE_URL="your_postgres_connection_string"
PORT=3001
  1. Run migrations and seed data (optional but recommended for first setup):
npx prisma migrate deploy
npx prisma db seed
  1. Start the API:
npm run dev

The API will run at http://localhost:3001 unless you set a different PORT.

Endpoints

GET    /campuses
GET    /campuses/:id      (includes enrolled students)
POST   /campuses
PUT    /campuses/:id
DELETE /campuses/:id      (unenrolls its students instead of deleting them)

GET    /students
GET    /students/:id      (includes its campus, if any)
POST   /students
PUT    /students/:id      (also used to change or clear a student's campus)
DELETE /students/:id

Errors and Params

All writes are validated server-side. Missing/invalid fields return a 400 with an error message. A student's email must be unique and a valid email format. GPA must be between 0.0 and 4.0.

Deployed URLs

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages