Skip to content

This si the server-side and database for Scheduler.

Notifications You must be signed in to change notification settings

Samy0412/scheduler-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interview Scheduler API (server-side)

Setup

Install dependencies with npm install.

Creating The DB

You need to use a machine with PostgreSQL installed on it.

Create a database with the command CREATE DATABASE scheduler_development;.

Copy the .env.example file to .env.development and fill in the necessary PostgreSQL configuration (all the [ ] need to be filled using your configuration data)

PGHOST=localhost
PGUSER=[]
PGDATABASE=scheduler_development
PGPASSWORD=[]
PGPORT=5432

Seeding

Run a the development server with npm start.

Go to http://localhost:8001/ in your browser.

Both of these achieve the same result.

  • Make a GET request to /api/debug/reset with curl http://localhost:8001/api/debug/reset.
  • Use the browser to navigate to http://localhost:8001/api/debug/reset.

The development data is random. Each time we seed we expect to see different appointments.

Run The Server

Running the server normally

npm start

Running the server so it returns an error when saving/deleting for testing the client's error handling capabilities

npm run error

Api

Days

GET /api/days

Response

[
  {
    "id": 1,
    "name": "Monday",
    "appointments": [1, 2],
    "interviewers": [1, 2],
    "spots": 0
  }
]

Appointments

GET /api/appointments

Response:

{
  "1": {
    "id": 1,
    "time": "12pm",
    "interview": {
      "student": "Lydia Miller-Jones",
      "interviewer": 1
    }
  },
  "2": {
    "id": 2,
    "time": "1pm",
    "interview": {
      "student": "Archie Cohen",
      "interviewer": 2
    }
  }
}

PUT /api/appointments/:id

Body:

{
  "interview": {
    "student": String,
    "interviewer": Number
  }
}

DELETE /api/appointments/:id

Interviewers

GET /api/interviewers

Response:

{
  "1": {
    "id": 1,
    "name": "Sylvia Palmer",
    "avatar": "https://i.imgur.com/LpaY82x.png"
  },
  "2": {
    "id": 2,
    "name": "Tori Malcolm",
    "avatar": "https://i.imgur.com/Nmx0Qxo.png"
  }
}

About

This si the server-side and database for Scheduler.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%