Skip to content

This is a sample college application and a database.

License

Notifications You must be signed in to change notification settings

aisha-als/college-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

college-application

This is a sample college API application written using Node.js and Express.js to allow for the functional requirements of a college.

The application connectes to a MySQL database in the backend.

Table of Contents

Install

This package is written using Node.js version v22.5.0.

To install this application, clone the git repository:

git clone https://github.com/aisha-als/college-api.git

To install the dependencies, run the following command:

npm install

The dependencies are defined in package.json file.

Usage

Update the db.js file with the parameters to connect to your MySQL database.

To start the Node.js server, run:

cd src
node server.js

Authorisation is implemented by sending the UserID as a header in the http request using the key: UserID

The Courses API endpoints and a sample required body for this application are:

  • List available courses (student role)

    GET /api/courses/availablecourses

  • Enable a course (admin role)

    PUT /api/courses/enable

    Body: { "CourseID": "4" }

  • Disable a course (admin role)

    PUT /api/courses/disable

    Body: { "CourseID": "4" }

  • Assign a course (admin role)

    PUT /api/courses/assign

    Body: { "CourseID": "6", "TeacherID": "6" }

The Enrolments API endpoints and a sample required body for this application are:

  • Enrol into a course (student role)

    POST /api/enrolments/enrol

    Body: { "CourseID": "5" }

  • Pass a student (teacher role)

    PUT /api/enrolments/pass

    Body: { "CourseID": "1", "StudentID": "6" }

  • Fail a student (teacher role)

    PUT /api/enrolments/fail

    Body: { "CourseID": "1", "StudentID": "6" }

Testing

Testing has been done using Postman to send HTTP requests to the API endpoints. A Postman collection file has been added to the tests/ directory.

Contributing

Please open a PR for contributions.

License

MIT License.

See license in LICENSE

About

This is a sample college application and a database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published