Skip to content

Last deliverable (D5 - API development) for the software engineering group project at UniTn 24/11/2021-16/12/2021.

Notifications You must be signed in to change notification settings

StellaDaniele/G12-software-engineering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deliverable D5 - APIs development

Members Mail
Daniele Stella (team leader) daniele.stella@studenti.unitn.it
Alessio Blascovich alessio.blascovich@studenti.unitn.it
David Stanicel david.stanichel@studenti.unitn.it

Table of contents

What is this?

This is a part of the last deliverable (D5) for the Software engineering course at UniTn. The course consisted of one big group project, divided into six deliverables in total, that can be found in this repository.

Goal

Develop the APIs to implement all the features identified in the D5, based on the other parts of the project. The requirements for this part of the project were:

  • Connect to at least one (external) API or DB
  • Realize at least three different pages
  • Develop some APIs
  • Document and test some of the APIs developed

What did we do?

We developed 13 APIs, fully documented. We tested them all and wrote four automatic testing scripts (supertest + tape). One of the scripts tests an API with all kinds of inputs.
We realized a database with MongoDB and four different pages in total:

  • Home - Daily summary
  • Histories
  • Trainer
  • My diet and training schedules

Since the focus was just on the APIs, and we had not studied web design (nor web development) formerly, we designed a really basic and rough UI, but it is enough to test the APIs developed.

Who did what?

Daniele developed most of the scripts: all the APIs, the tests, and some for the front end. He also wrote the documentation for the APIs. Alessio developed some scripts for the front end, part of the UI and created the database with MongoDB. David created almost all the UI.

Dependences

The dependences of the local APIs can be found in the package.json, located in the api directory.

Documentation

All the APIs developed are fully documented (in Italian) using JSDoc and SwaggerUI:

Documentation

The documentation can be found on localhost:5000/api-docs once started the server.

How to start the server

MongoDB connection string

We created a small database with MongoDB just to test our APIs. The connection string can be found in the document delivered. It will be changed or probably deleted as soon as the results will be published, for obvious reasons.

UPDATE: The DB is no longer available. If you want to try the APIs that use the DB you must create a new DB (or simply link a JSON) with the following structure:

[{
  "nome": Name of the food (string),
  "energia": kcal (int),
  "grassi": fats (double),
  "carboidrati": carbohydrates (double),
  "proteine": proteins (double),
  "fibre": fibers (double),
  "ferro": iron (double),
  "iodio": iodine (double),
  "magnesio": magnesium (double)
}]
Starting the server

To start the server you just need to execute the command npm start in the api directory:

Start server

The server runs on localhost:5000/ as stated above.

API Testing

All the APIs control the input data to meet the requirements and some of them were tested using Supertest and Tape. To run the tests, execute the command npm test in the api directory. The script that performs the scripts can be found in api/test/index.js. Note that the server starts to listen also when running the testing (the listening function is in api/index.js, with the local APIs), so it won't end but you can see the results nonetheless.

API Testing

About

Last deliverable (D5 - API development) for the software engineering group project at UniTn 24/11/2021-16/12/2021.

Topics

Resources

Stars

Watchers

Forks