!! Deployed at https://open-study-college-application.herokuapp.com/ !!
This API offers Create, Read, Update and Delete operations from the Open Study Colleges database.
Built using
- Express
- Typescript
- Jest
Install all dependencies with npm run i
In:
./.env.config
Add in your PostgreSQL database URI to the DATABASE_URL variable, then rename the file to .env
Run npm run db:initialSetUp
to run set up scripts.
Run the development server with npm run dev
Install all dependencies with npm run i
Run the development server with npm run dev
The package.json provides useful script for quickly manipulating the database.
Run npm run test
Courses:
GET:
-/courses
: Get all courses
-/courses/courseID
: Get course by ID. Includes extra information: QandAs
POST:
-/courses
Requires body:
-courseCode:string
-name:string
-tag:string
-atAGlance:JSON
-overview:JSON
-extrainfo:JSON
-examDetails:JSON
PUT
-/courses/courseCode
Requires body:
changeList:[column:string, newData:any]
DELETE
-/courses/courseCode
QandAs:
GET:
-/qandas
: Get all Q and As
-/qandas/qandaID
: Get QandA by ID.
POST:
-/qandas
Requires body:
-courseCode:string
-question:string
answer:string
PUT
-/qandas/qandaID
Requires body:
changeList:[column:string, newData: any]
DELETE
-/qandas/qandaID
Users:
GET:
-/users
: Get all users
-/users/usersID
: Get user by ID. Includes extra information: cart
POST:
-/users
Requires body:
userID:string,
name:string
PUT
-/users/userID
Requires body:
changeList:[column:string, newData: any]
DELETE
-/users/userID
Carts:
GET:
-/carts
: Get all carts
-/carts/userID
: Get cart by user ID. Includes extra information: cartItems
POST:
-/carts
Requires body:
userID:string,
totalCost:string
PUT
-/carts/userID
Requires body:
changeList:[column:string, newData: any]
DELETE
-/carts/userID
CartItem:
GET:
-/cartitems
: Get all users
-/cartItems/userID
: Get cart items by userID.
POST:
-/cartItems
Requires body:
userID:string,
courseSelected:string
cost:number
PUT
-/cartitems/cartItemID
Requires body:
changeList:[column:string, newData: any]
DELETE
-/cartItems/cartItemID