The scope of this project was to create an API to organize and recall the courses provided by the name of the course , the course type or the university in which it takes place. The API is based on 3 Schemas:
- Course type -> defines the type of the course
- University -> contains the name of the University
- Course -> data of the course : name , type, universities that provide it.
Using the correct endpoints you can Create, Read, Update or Delete (CRUD). Using queries is possible to search through the courses.
For this course were used Node.Js with Express.Js framework and MongoDB as database.
In order to install the API Node.Js is required and you may need an online Database, i suggest MongoDB Atlas.
-
You don't have Node.Js ? No problem, download it here: Node.Js.
-
Need an online Database ? Login of create an account on MongoDB Atlas , create your database, go to Connect -> Drivers and save the connection string provided we will need it later.
After those steps you are all set up
git clone https://github.com/davide-lombardo/courses-crud.git
npm install
npm start
If it doesn't exist create a .env
file and insert the environment variables, there is a .env_example
to help you do it.
You can use something like Postman(download it here!) or Insomnia, to begin to use the API, simply by typing:
localhost:3000/desiredEndpoint
Method | Endpoint | Result |
---|---|---|
POST | /api/courseTypes/ | create a new course type |
PATCH | /api/courseTypes/:id | modify a course type |
DELETE | /api/courseTypes/:id | delete a course type |
GET | /api/courseTypes/ | get all course types |
GET | /api/courseTypes/:id | get a single course type |
Method | Endpoint | Result |
---|---|---|
POST | /api/universities/ | create a new university |
PATCH | /api/universities/:id | modify a university |
DELETE | /api/universities/:id | delete a university |
GET | /api/universities/ | get all universities |
GET | /api/universities/:id | get a single university |
Method | Endpoint | Result |
---|---|---|
POST | /api/courses/ | create a new course |
PATCH | /api/courses/:id | modify a course |
DELETE | /api/courses/:id | delete a course |
GET | /api/courses/ | get all courses |
GET | /api/courses/:id | get a single course |
Method | Endpoint | Result |
---|---|---|
GET | /api/courses?typeId=example123 | get all courses of a type |
GET | /api/courses?universityId=example123 | get all courses of a university |
GET | /api/courses?typeId=example123&universityId=example123 | get all courses of a type in a university |
- Express.Js
- Mongoose
- Http-Status-Codes
- dotenv
- Validator.js
- Morgan
- Helmet
- express-mongo-sanitize
- Jest
- Supertest
At the moment the project should run without problems. In case you find some issues let me know!
- My Linkedin Profile: Linkedin
The scope of this project was to create an API to organize and recall the courses provided by the name of the course , the course type or the university in which it takes place. The API is based on 3 Schemas:
- Course type -> defines the type of the course
- University -> contains the name of the University
- Course -> data of the course : name , type, universities that provide it.
Using the correct endpoints you can Create, Read, Update or Delete (CRUD). Using queries is possible to search through the courses.
For this course were used Node.Js with Express.Js framework and MongoDB as database.
In order to install the API Node.Js is required and you may need an online Database, i suggest MongoDB Atlas.
-
You don't have Node.Js ? No problem, download it here: Node.Js.
-
Need an online Database ? Login of create an account on MongoDB Atlas , create your database, go to Connect -> Drivers and save the connection string provided we will need it later.
After those steps you are all set up
git clone https://github.com/davide-lombardo/courses-crud.git
npm install
npm start
If it doesn't exist create a .env
file and insert the environment variables, there is a .env_example
to help you do it.
You can use something like Postman(download it here!) or Insomnia, to begin to use the API, simply by typing:
localhost:3000/desiredEndpoint
Method | Endpoint | Result |
---|---|---|
POST | /api/courseTypes/ | create a new course type |
PATCH | /api/courseTypes/:id | modify a course type |
DELETE | /api/courseTypes/:id | delete a course type |
GET | /api/courseTypes/ | get all course types |
GET | /api/courseTypes/:id | get a single course type |
Method | Endpoint | Result |
---|---|---|
POST | /api/universities/ | create a new university |
PATCH | /api/universities/:id | modify a university |
DELETE | /api/universities/:id | delete a university |
GET | /api/universities/ | get all universities |
GET | /api/universities/:id | get a single university |
Method | Endpoint | Result |
---|---|---|
POST | /api/courses/ | create a new course |
PATCH | /api/courses/:id | modify a course |
DELETE | /api/courses/:id | delete a course |
GET | /api/courses/ | get all courses |
GET | /api/courses/:id | get a single course |
Method | Endpoint | Result |
---|---|---|
GET | /api/courses?typeId=example123 | get all courses of a type |
GET | /api/courses?universityId=example123 | get all courses of a university |
GET | /api/courses?typeId=example123&universityId=example123 | get all courses of a type in a university |
- Express.Js
- Mongoose
- Http-Status-Codes
- dotenv
- Validator.js
- Morgan
- Helmet
- express-mongo-sanitize
- Jest
- Supertest
At the moment the project should run without problems. In case you find some issues let me know!
- My Linkedin Profile: Linkedin