Quickstart
This quickstart guide is recommended to fully understand how the i3Hub platform works. The purpose of this tutorial is to provide the developer with a simple working application that can be directly integrated with I3HUB. Through this, we also want to make developers understand what are the components of the system and how to approach their development to create new applications.
At this point, we take for granted the reader's familiarity with the microservices architecture of the system. If not, start from architecture
Estimated completion time: ~ 20 minutes
Requirements
First of all, you need to install the development environment for NodeJS on your device. This requires the installation of:
- node
- npm
Node version
The project was tested using node with the following versions:
- 15.14.0
- 16.11.0
- 16.13.2
It is reported that there are issues with node v17
Live Development
In traditional microservice software development, it is usually necessary to mock the surrounding services in order to perform tests. Given the architecture of i3HUB, it is possible to check the correct integration of your application without installing anything.
Start your application
For the purpose of this project we will start by downloading one of the templates available to create a new service:
To download the project, perform a git clone
from the repository of one of the projects listed above.
Once the project has been downloaded, it is necessary to add all its dependencies to start it. To do so you must first enter the project folder: (in the tutorial we will continue with the qr code project)
cd qrcode/
npm install
npm run dev
cd qrcode/
yarn
yarn dev
Once started, our application will be available on port 3010 and accessible via http://localhost:3010.
If everything went well, you should see a similar screen:
If not, see the next step.
Run without a proxy
The way in which the i3hub hosted online is able to detect an application running locally is presented below.
Since the search process of local services only is left to the client, it is possible to "convince" the client that one of the services is looking for is at a URL reachable through your browser even if it is not available through other DNSs.
As long as your application during development is on one of the following URLs:
- https://micro.localhost (HTTPS link)
- http://localhost:3010 (HTTP link)
It will be correctly retrieved by I3HUB.
Proxy
Another option allows you to continue by choosing not to use any proxy and modify a value within the browser's localStorage. Unfortunately, this method could have disadvantages: for example, your application would be served via HTTP while I3HUB is on HTTPS, creating possible conflicts due to browser policy on mixed content. We strongly recommend to proceed with a proxy available but for a quick test of system capabilities you can choose the other method as well.
This method is recommended through the use of a proxy such as recommended here.
Cannot find/run the application
If you cannot find your application through the i3hub platform, probably your browser is blocking it. Some browsers (like Safari) are really strict about the HTTPS cross-site content serving, so just switch to a proxy.
Done!
At this point it is sufficient to log in with your account at https://hub.i3lab.group.
Your application will be detected with a special tag, that of "Development" as shown in the image. The application will have the same behavior as if it were in production.
Then, you can start a new session and select your application. If everything went well, you should see the following: