Deploy an App with Eureka
Build an App under 5 minutes.
This guide helps you in creating your first application with IndustryApps AppStore.
Before creating the application you need to complete the registration step as explained under Register developer account.
The application tutorial here is only to provide you a quick approach to create a simple hello world application using Eureka and view it inside IndustryApps. It would give you a quick understanding on the business model by utilising the Eureka Service Discovery.
npm init -y

npm install eureka-js-client express nodemon --save
- eureka-js-client to implement registry sync
- express as application server
- nodemon to react with changes without reloading
'use strict';
const express = require('express');
const Eureka = require('eureka-js-client').Eureka;
const APPLICATION_CODE = process.env.APPLICATION_CODE;
const APP_REGISTRY_HOST = process.env.APP_REGISTRY_HOST;
const APP_REGISTRY_PORT = process.env.APP_REGISTRY_PORT;
const APP_HOST = process.env.APP_HOST;
const APP_PORT = process.env.APP_PORT;
const app = express();
// example configuration
const client = new Eureka({
// application instance information
instance: {
app: `${APPLICATION_CODE}`,
hostName: APP_HOST,
ipAddr: APP_HOST,
statusPageUrl: `http://${APP_HOST}:${APP_PORT}`,
vipAddress: `${APPLICATION_CODE}`,
port: {
$: APP_PORT,
'@enabled': 'true',
},
dataCenterInfo: {
'@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo',
name: 'MyOwn',
},
registerWithEureka: true,
fetchRegistry: true,
},
eureka: {
// eureka server host / port
host: APP_REGISTRY_HOST,
port: APP_REGISTRY_PORT,
servicePath: '/eureka/apps/',
},
});
client.logger.level('debug');
client.start(error => {
console.log(error || 'NodeJS Started!');
app.get('/', (req, res) => {
res.sendFile(__dirname + '/index.html', err => console.log);
});
});
app.listen(APP_PORT, APP_HOST);
console.log(`Running on http://${APP_HOST}:${APP_PORT}`);
<html>
<head>
<title>Sample App</title>
<link href="/dam/public/iapp-ui-styles/v.1.0.0/main.css">
<script src="/dam/public/iapp-generics/v.1.0.1/iapp-generics.js"></script>
</head>
<body>
<iapps-require-module>
<iapps-module name="basic"></iapps-module>
</iapps-require-module>
<iapps-header-sidebar></iapps-header-sidebar>
<div class="content-area bg-grey">
<h1>Hello from sample app</h1>
</div>
</body>
</html>
Following urls
/dam/public/iapp-ui-styles/v.1.0.0/main.css
and/dam/public/iapp-generics/v.1.0.1/iapp-generics.js
will be resolved when you access the application via local gateway.FROM node:carbon
# create the app directory for inside the Docker image
WORKDIR /usr/src/app
# install app dependencies from the package.json (and the package-lock.json)
COPY package*.json ./
RUN npm install
# bundle app source inside Docker image
COPY . .
# expose port 8080 to have it mapped by Docker daemon
EXPOSE 8080
# define the command to run the app (it's the npm start script from the package.json)
# npm start
CMD [ "npm", "start" ]
When accessing the URL of the platform provided by the team you will find a screen like below.

When clicking on the menu item

you will be redirected to your app. Screenshot based on above snippet is given below.
Last modified 9mo ago