This is a Public API that contains general information such as attributes or names of faculties, regional campuses, and study programs at Universitas Pendidikan Indonesia (UPI), ranging from undergraduate to doctoral levels.
This project use NestJS framework that writes in Typescript, and use MongoDB database. The database contains 2 collection, faculties
and studies
.
Furthermore, The 'faculty' term refers to both 'faculty' and 'regional campus' because both have same level and similar entities.
faculties
collection stores all of faculty document
that each document has fields:
_id
, The auto generated document id by MongoDB.code
, The code of faculty (primary key).name
, The name of faculty.abbr
, The abbreviation of faculty's name.
studies
collection stores all of study program document
that each document has fields:
_id
, The auto generated document id by MongoDB.code
, The code of study program (primary key).name
, The name of study program.faculty
, The faculty's code of study program (foreign key).
GET /faculties
- Use this endpoint to get all of faculty.
- It will return an array of faculty.
- Usage example : https://faculty-upi.herokuapp.com/faculties
GET /faculties/{facultyCode}
- Use this endpoint to get a specific faculty by its code.
- The
facultyCode
must be an alphabet character. If not, you will get400 Bad Request
response. - The response will be
404 Not Found
if there are no faculty with code that equals tofacultyCode
. - Usage example : https://faculty-upi.herokuapp.com/faculties/a
GET /faculties/{facultyCode}/studies
- Use this endpoint to get all of study programs in a specific faculty.
- The
facultyCode
must be an alphabet character. If not, you will get400 Bad Request
response. - The response will be
404 Not Found
if there are no faculty with code that equals tofacultyCode
. - Usage example : https://faculty-upi.herokuapp.com/faculties/a/studies
GET /faculties/name/{facultyName}
- Use this endpoint to find faculties by its name.
- The
facultyName
must be at least 3 characters. If not, you will get400 Bad Request
response. - The response will be an empty array
[]
if there are no faculty matched withfacultyName
. - Usage example : https://faculty-upi.herokuapp.com/faculties/name/kampus
GET /faculties/abbr/{facultyAbbr}
- Use this endpoint to find faculties by its abbreviation.
- The
facultyAbbr
must be at least 3 characters. If not, you will get400 Bad Request
response. - The response will be an empty array
[]
if there are no faculty matched withfacultyAbbr
. - Usage example : https://faculty-upi.herokuapp.com/faculties/abbr/kamda
GET /studies
- Use this endpoint to get all of study program.
- It will return an array of study program.
- Usage example : https://faculty-upi.herokuapp.com/studies
GET /studies/{studyCode}
- Use this endpoint to get a specific study program by its code.
- The
studyCode
must be 4 alphanumeric characters. If not, you will get400 Bad Request
response. - The response will be
404 Not Found
if there are no study program with code that equals tostudyCode
. - Usage example : https://faculty-upi.herokuapp.com/studies/G505
GET /studies/name/{studyName}
- Use this endpoint to find study programs by its name.
- The
studyName
must be at least 3 characters. If not, you will get400 Bad Request
response. - The response will be an empty array
[]
if there are no study program matched withstudyName
. - Usage example : https://faculty-upi.herokuapp.com/studies/name/pendidikan
Go to API documentation for more details about the endpoint. You can also try to use it by clicking the "Try it out" button inside each endpoint.
1. Create .env
file
You can easily duplicate the .env.example
file and rename it to .env
.
2. Configure HOST
and PORT
Open .env
file, then :
-
Set
HOST
with the hostname of your app. The default islocalhost
. -
Set
PORT
with port number you want to use. The default is3000
.
The default values of HOST
and PORT
is example values to used in development stage. You may have to change it later for production stage.
3. Configure database connection
Set MONGODB_CONNECT_URI
with connection string of your cluster. See MongoDB docs for details. The connection string looks like this :
mongodb+srv://USERNAME:PASSWORD@CLUSTER_URI/DB_NAME?retryWrites=true&w=majority
4. App is ready
Now you are ready to run the app on local.
For run the app in development environment, use this command :
$ npm run start
See nestjs.README.md file for details.
Finally, you can access the endpoint from http://localhost:3000 by default, or depends on PORT
settings at .env
file.