Members | |
---|---|
Daniele Stella (team leader) | [email protected] |
Alessio Blascovich | [email protected] |
David Stanicel | [email protected] |
- What is this?
- Goal
- What did we do?
- Who did what?
- Dependences
- Documentation
- How to start the server
- API Testing
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.
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
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.
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.
The dependences of the local APIs can be found in the package.json, located in the api directory.
All the APIs developed are fully documented (in Italian) using JSDoc and SwaggerUI:
The documentation can be found on localhost:5000/api-docs once started the server.
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)
}]
To start the server you just need to execute the command npm start in the api directory:
The server runs on localhost:5000/ as stated above.
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.