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:
Create a package.json file
Copy into the package.json file the necessary dependencies
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.
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.
Copy into nuxt.config.js
the following configurations. The client-side will call the API on port 5000
once we containerise the application.
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.
Now, we can create a pages directory which will automatically create routes for each .vue file inside the directory.
Create an index.vue
file which will be the primary page on the app.
Populate the index.vue
file:
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.
Last updated