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).
- Node + Express
- Prisma ORM
- PostgreSQL (hosted on Neon)
- Clone this repository and move into the server folder:
cd campuses-server- Install dependencies:
npm install- Create a
.envfile incampuses-server/with your database connection string:
DATABASE_URL="your_postgres_connection_string"
PORT=3001- Run migrations and seed data (optional but recommended for first setup):
npx prisma migrate deploy
npx prisma db seed- Start the API:
npm run devThe API will run at http://localhost:3001 unless you set a different PORT.
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
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.
- Backend: https://final-project-server-csci395.onrender.com/
- Frontend (paired client app): https://final-project-csci395-i7qmeomjz-asm-web-dev.vercel.app