- a REST API
- A Database
For the Database I have decided to adopt MySQL, installed on the Raspberry PI that works as Hub/Gateway.
Here the only important thing that I want to mention is that I have decided to store the datafiles not on the SD card (too many writes, I don’t want to risk to destroy it before the time) but on an external USB disk, attached to a USB Hub (powered). It works fine.
The DB schema will contain two types of data:
- Reference Data
- Message Data (from devices)
But I have decided also that I need a REST API, to be able, for example, to easily integrate data-access from a future Mobile UI.
Here, I have made some important decisions, and I have already developed a working prototype to test the decision made and their effectiveness:
- The interface of the REST API is documented using OpenAPI (Swagger 2.0)
- I have adopted a Top-Down approach: first, design of the Interface, using Swagger, then development of the code
- The language selected for the API implementation is JavaScript, with NodeJS
- I have decide to use the Express Framework and Swagger modules
Swagger not only is really useful and not-so-complicated for describing the REST API, but using the Swagger NodeJS Modules I can easily access online to the documentation and, with Swagger UI, I have a nice UI to test the API and to use it.
Here you see the a picture of the Swagger UI:
I will write some more blog’s posts on Swagger and My REST API. Stay connected.
No comments:
Post a Comment