= IoT server example ! Apostolos rootApostolos@swarmlab.io // Metadata: :description: Intro and Install :keywords: IoT :data-uri: :toc: right :toc-title: Πίνακας περιεχομένων :toclevels: 4 :source-highlighter: highlight :icons: font :sectnums: {empty} + == Intro .Intro IoT server **** - software use - ti tha kanoume ehre - etc **** [NOTE] ==== .Imaging a swarm image:./Swarming2.png[alt="Swarm"] .Architecture of swarm communication image:./swarmlabn-1.png[alt="Swarm Gateway"] - Red Node: Sensor Node and Gateway Role - Black and Red Node: Sensor Node - Client ==== == Prepare installation === Install Docker == Technolofies === MVC A core principle of the MVC pattern is the view layer's ignorance with respect to the model layer. Views are dumb objects. They only know how to present data to the user. They don't know or understand what they are presenting. MVC: Division across three code components only Model, View, and Controller. ... Microservices: An app is divided into a set of specialized which are not predefined like that in MVC and interact with each other using APIs. This model is being used by companies like Netflix, Spotify, and eBay. Model: This part manages the data on your site. Its role is to retrieve the raw information from the database, organize, and assemble it so that it can be processed by the controller. View: This part focuses on the display. It is here that the data recovered by the model will be used to present them to the user. Controller: This part manages the logic of the code that makes decisions. When the user interacts with the view, the request is processed by the controller. It waits for the user to interact with the view to retrieve the request. Thus, it is the controller that will define the display logic, and display the next view on the screen. === Microservices Architecture Microservices can be defined as an improvement, a kind of refinement, of what we know as service-oriented architecture (SOA). In this architecture, a large application is made in the form of small monofunctional modules. Each microservice is autonomous. Microservices do not share a data layer. Each has its own database and load balancer. So that each of these services can be deployed, adjusted, and redeployed individually without jeopardizing the integrity of an application. As a result, you will only need to change one or more separate services instead of having to redeploy entire applications. == Software === Client site (PC) ==== Vue .vuejs [NOTE] ==== Vue.js is an open-source progressive JavaScript framework for building user interfaces (UIs) and single-page applications; ==== *Library modularization* using a framework is common in frontend development. What differentiates Vue.js from other alternatives is - its *“high decoupling”*, how easy it is to extend functionalities, and how well all parts work once more modules are included. For example, if we want to organize and render small visual components, all we need is Vue.js’s ‘core’ library; it is unnecessary to include additional libraries. As the application grows, - we have libraries to manage *routes* such as *‘vue-router’*, - libraries to manage the global state such as *‘vuex’* - or libraries to build responsive web applications such as *‘bootstrap-vue’*. Additionally, if our application needs to be optimized or needs good SEO, we can include the *‘vue-server-rendering’* library. In the following figure, we can see how the libraries we just mentioned are progressively included, from a small SPA to multi-page applications (MPA). image::./intro.png[intro] TIP: The name of the framework – Vue – is the same phonetically in English as view, and it corresponds to the traditional Model-View-Controller (MVC) architecture React and Angular is also Frameworks equal to vuej ==== Vuex Vuex is a state management pattern + library for Vue.js applications. - It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion. - It also integrates with Vue's official devtools extension to provide advanced features such as zero-config time-travel debugging and state snapshot export / import. .What is a "State Management Pattern"? [NOTE] ==== *Let's start with a simple Vue counter app:* [source,javascript] ---- new Vue({ // state data () { // <1> return { count: 0 } }, // view template: ` // <2>