Use this link to apply and setup the BTP trial or enterpise enviroment
Nodejs
Install and setup Nodejs.
IDE
we can use the VSC as you favourite development IDE, or other IDE you like.
- VSC Install the vetrur extension
CF Command line
Dowanload and Configration : Download and Install the Cloud Foundry Command Line Interface
Direct Download link: https://github.com/cloudfoundry/cli#downloads
Steps:
-
Install the vue cli via the command :
npm install -g @vue/cli
-
create vue project via the command :
vue ui
orvue create my-project
-
add dev and prod mode envrioment variable for multiple development mode under root folder
fileName: .env.dev
NODE_ENV = 'dev' VUE_APP_PORT=3000
fileName: .env.prod
NODE_ENV = 'prod' VUE_APP_PORT=80
-
add vue.config.js
and here is the example code :
var env = process.env.NODE_ENV;
var bdisaBleHostCheck = false;
let evnPort = process.env.PORT;
if (env === "dev") {
evnPort = 3000;
bdisaBleHostCheck = false
} else {
bdisaBleHostCheck = true;
}
module.exports = {
devServer: {
port: evnPort,
disableHostCheck: bdisaBleHostCheck
}
}
Run Vue project with command line npm run serve
Test it with the link : http://localhost:8080/#
and then get this page .
After that , the nodejs applciation is working fine
Deploy for BTP:
-
set cloud foundry endpoint via command :
cf api {EndpointURL}
-
login to your BTP endpoint with your btp user and password command :
cf login
-
add manifest.yml for CF BTP development
-
configure the route and nodejs buildpacks
here we suggest use bellow format as recomendation :
{subdomain}-{appname}.{cfappdoman}
subdomain:
appname: defined by business
cfappsdomain: user the command cf domains
to get the domain url
Example:
---
applications:
- name: nodejsapp
command: npm run serve
memory: 400M
path: btpnodejs
buildpacks:
- nodejs_buildpack
routes:
- route: 91ccc175trial-nodejsapp.cfapps.ap21.hana.ondemand.com
-
Deploy your nodjs project to your BTP Subaccount
command :
cf push
- Navigte to your space
- Go you applcation
- Get applicaiton URL
-
Test it with the URL
{applicaitonURL}/#/
After get the below response, then your nodejs application is working fine
Create and Deploy Your First Node.js App: btp-nodejs-deploy
Vue JS guide : VueJs Guide