maven multi module with both front end and backend

follow up to https://lwpro2.wordpress.com/2011/09/20/maven-multi-module/

for maven multi module project with both front end and back end, there are two ways to run the app:

  1. if it’s exploded, the front end and back end application can run separately, eg 1 nodejs app for front end, 1 separate java spring boot process for the backend; for this approach to direct the traffic from front end to back end, it require a proxy
//for example, for angular, this could be
//package.json
"run_local": "ng serve --proxy-config proxy.conf.json"

//where proxy.config.json would be
{
"/api":
{
"target": "http://localhost:3000",
"secure": false
}
}
//or
{
"/api":
{
"port": "3000",
"secure": false
}
}

source:

front end proxy: https://create-react-app.dev/docs/proxying-api-requests-in-development/

https://angular.io/guide/build#proxying-to-a-backend-server

2. if it’s packaged(uber jar)/not-exploded or to run both front end and backend in single process whether exploded or not, then the front end can be built (with the assets moved either static/public:

Spring Boot comes with a pre-configured implementation of ResourceHttpRequestHandler to facilitate serving static resources.

By default, this handler serves static content from any of the /static, /public, /resources, and /META-INF/resources directories that are on the classpath.

), which can packaged as a separate jar for example. As long as the /static, /public folder is top level at the jar

as such, when backend (spring boot application start), it (the embedded tomcat for example) would serve both the backend (spring MVC) and front end (through above: ResourceHttpRequestHanlder).

ref: https://ashokgurudayal.hashnode.dev/multi-module-projects-and-packaging-frontend-backend-together

when maven package the jar, the /static folder would become top level of the package (/target/classes are removed)

ref: https://ashokgurudayal.hashnode.dev/multi-module-projects-and-packaging-frontend-backend-together

https://github.com/prashantpro/ng-jee

https://www.beyondjava.net/angular-maven

cloud foundry login issue with sap

i have face a lot of issues connecting sap cloud foundry from cf cli. the issue includes, failed authentication, unauthorized, locked password etc.

the solution, turns out is to use `

`cf login –sso, which would use the temporary authentication code from the API, which worked.

source:

https://community.sap.com/t5/technology-q-a/cloud-foundry-login-error/qaq-p/12477996

https://help.sap.com/docs/btp/sap-business-technology-platform/log-on-to-cloud-foundry-environment-using-cloud-foundry-command-line-interface

git for aws codecommit

for git ssh connection to AWS code commit, after uploading the public key, the trick is to have a specific config file to tell the user/public_key_id to associate with code commit

  1. upload the existing ssh key

run `cat ~/.ssh/id_rsa.pub| pbcopy

`

2. add the special conf file

3. then run ssh git-codecommit.us-east-2.amazonaws.com for testing

ref: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html

aws cli for security group

when creating security group using aws cli, the VPC could be specified using “–vpc-id vpc-xxx, otherwise, it will use the default VPC.

after the sg is created, to set up the inbound rules, the parameter to specify the sg is through “–group-id, if using –group-name it would result in “The security group does not exist in default VPC”. And there is no parameter to specify the VPC.

https://github.com/aws/aws-sdk/issues/402