Developer Documentation
  • Documentation Overview
  • Development Introduction
  • Getting Started
  • Fundamentals
    • Deploy an App via Pre-defined Sidecar
      • Sidecar Tutorial: Server-side
      • Sidecar Tutorial: Client-side
      • Sidecar Tutorial: Docker & Deploy
    • Deploy an App with Eureka
    • Design Guidance
  • Authentication
    • Accessing data exposed by the platform
    • Single Sign-On
      • Angular
      • Vue
      • Java Spring: Accepting JWT
      • Python Django: Accepting JWT
    • User and Role Identification
  • APIs | Data Integration
    • Submodel Index
    • Masterdata
    • Transactional data
  • Docker Information
    • Ruby Stack
    • Golang Stack
    • Node JS Stack
    • Java Spring Stack
    • Python Stack
  • Connect to the Platform
    • Integrate using Eureka Rest APIs
    • Use our Pre-built sidecar
    • Production deployment
  • Add-on Features
    • IApps-Navigation
  • Testing
  • FAQs | Troubleshooting
  • Registration
    • Application pre-requisites
      • Basic Requirements
    • Register Developer Account
    • Submit basic application info
    • Onboard Application
      • Submit Appstore details
        • App basic information
      • Configure Application
        • App Permission
        • App Data
        • AAS Instance
        • Licensing
        • Access Rights
        • Account Info
        • Terms Of Use
        • Pricing
      • Publish and test
        • Deploy
        • Register into Service Discovery
    • Publish to Marketplace
  • User Experience
  • The business model - How do I get paid?
  • References
    • IndustryApps - Intro
    • What is an Asset Administration Shell?
    • What is ECLASS?
      • How is ECLASS and Concept dictionary are used
    • Industry 4.0 standards
    • Customer Terms of Use
      • Subscription Order
    • Solution provider Terms of Use
      • Contract regions
      • Submission Form ( Solution provider)
Powered by GitBook
On this page
  1. Fundamentals
  2. Deploy an App via Pre-defined Sidecar

Sidecar Tutorial: Client-side

In this part of the introductory tutorial, we will be building the client-side app with Nuxt JS a supporting framework for Vue JS.

Inside your QuickApp project directory, create a directory for the client-side app:

mkdir app
cd app

Create a package.json file

touch package.json

Copy into the package.json file the necessary dependencies

{
    "name": "my-app",
    "scripts": {
        "dev": "nuxt",
        "build": "nuxt build",
        "generate": "nuxt generate",
        "start": "nuxt start"
    },
    "dependencies": {
        "@nuxtjs/axios": "^5.13.6",
        "nuxt": "^2.15.8"
    }
}

scripts define Nuxt commands that will be launched with the command npm run <command>

Add Nuxt to the project by executing the following command in terminal, which will install and add the necessary node modules to the project.

npm install nuxt

Add a Nuxt configuration file to the app project directory so that we can define global variables such as API URL and any additional plugins we'd like to add.

touch nuxt.config.js

Copy into nuxt.config.js the following configurations. The client-side will call the API on port 5000 once we containerise the application.

nuxt.config.js
export default {
    publicRuntimeConfig: {
        baseURL: process.env.BASE_URL || 'http://0.0.0.0:5000/'
      },
    server: {
        port: process.env.NUXT_PORT,
        host: process.env.NUXT_HOST
    },
    buildModules: [
    ],
    modules: [
    "@nuxtjs/axios"
    ],
    components: true,
    
}

In order to fetch data from the server-side API, the app will use Axios. Install Axios onto the app project setup, by running the following command in terminal.

npm install @nuxtjs/axios

Now, we can create a pages directory which will automatically create routes for each .vue file inside the directory.

mkdir pages

Create an index.vue file which will be the primary page on the app.

touch pages/index.vue

Populate the index.vue file:

<template>
    <div>
        <h1> {{ messages.message }} </h1>
    </div>
</template>

<script>
export default {
    async fetch() {
        this.messages = await this.$axios.$get(this.$config.baseURL);
    },
    data(){
        return {
            messages: [],
        };
    },
};
</script>

<style lang="scss" scoped>

</style>

The index.vue file in the pages directory will call our message in the server-side API and display it as a title.

If you are testing the application prior to containerising with docker, you may need to change the IP of the server-side app in nuxt.config.js temporarily to fit its default (port 8000 instead of port5000).

This concludes the required setup for the client-side app. The following step will containerise the application with the IndustryApps pre-defined Sidecar.

PreviousSidecar Tutorial: Server-sideNextSidecar Tutorial: Docker & Deploy

Last updated 2 years ago