Member Contribution Report (Muhammet Tayyip Kamiloğlu) - bounswe/bounswe2023group7 GitHub Wiki

Important Issues Related to the Practice Application

  • #212: I described my API, its functionalities, its views how the schemas is created.
  • #213: I created database schema for the random game object. We used mongoose and MongoDB because it was easy to use with node.js
  • #207: It is related to unit tests. We used jest library because it is again easy to use with node.js.
  • #199: Described my planned steps to create frontend views and integrating them with overall app by using React.
  • #217: We created a database instance whose host is an AWS server. We use MongoDB Atlas to do this.
  • #216: We created the Dockerfiles and created images by using them. After creating them we run our backend and frontend containers in two AWS servers. After deploying them to AWS servers we tested functionalities of our APIs.

Third-Party URIs

I utilized the Steam Web API. Steam API is an API which can return all apps in Steam, it can also return information about the game while taking the appid. It includes price , image, platform, developer, release date informations and so many others. To make the API call, I used the following URI: https://api.steampowered.com/ISteamApps/GetAppList/v2/ and did not give any parameter. This URI is used to send a request to the Steam Web API. If you would like to learn more about the API, you can visit this from here.

API Functions

I have created three functions, including one GET request and one POST request. These functions are as follows:

  • isThatAGame - This function takes appId of the game and checks if its type is equal to 'game'. It does these by sending request to the Steam Web API.
  • getRandomGame - POST: This function send get request to this URI: (https://api.steampowered.com/ISteamApps/GetAppList/v2/). It choose a random object from the returned list and returns this game to the user.
  • getHistoryByEmailHandler - GET: This function takes email of the user and returns his history from database.

Unit Tests

Ekran Alıntısı Ekran Alıntısı2

  • I wrote four tests for random game API. First two controls the GET request functions. One of them is the succesful page, it checks that returned status is 200 or not. The other is the unauthorized version. I give empty accesToken to the request and it returns status code 401. If it is 401 test will pass. I made the same things for the POST functions.

Sample Calls

I'm using Postman to display requests and responses.

  • /random-game successful POST request:
  • /random-game failed POST request:
  • /random-game/history succesful GET request:
  • /random-game/history failed 'GET' request:

Challanges

I have encountered so many problems while writing this API. First problem I have encountered was learning the NodeJS. I was stranger to this language but ChatGPT was very helpful to me. I asked my errors to ChatGPT and it gave the reasons. I also asked so many question to my friend Ömer Şafak and he helped me so much. Another difficulty was writing the frontend part. I did not write React before so learning it was also hard. However, React is a very popular langauge and there are many resources on the internet and I used them effectively. ChatGPT was again savior for me. Another challenge was merging my branch to main branch. Before merging, I tried my API from another PC and encountered with an error. With Yunus Emre we solved this problem also.