I am evaluating the JHipster microservices architecture.
Where do I need to write my application specific configuration in jhipster-registry-master?
How can I get this configuration from Angular (gateway) and from Java (Microservice)?
Is there any documentation/example?
For java spring-boot, this is documented in Spring Cloud Config Server docs you have to choose either filesystem backend or git backend (but not jhipster-registry-master), for the angular part you could consume a REST resource on your java backend exposing a part of your configuration (you can see an example in ProfileInfoResource.java)
Related
Hi I want to deploy the jhipster frontend separated , can I do it ? or the correct way is to put it back in the same project with the backend.I can't find info on how to deploy it after been separated
Yes you can do it separately, you just need a web server to serve your frontend bundle and if you want to avoid CORS issues you should also configure it as a reverse proxy to your backend.
The web server could also be a CDN.
The reason why you don't find any JHipster doc on this is that it's not specific to JHipster.
is it possible to deploy spring rest application in node / node server.
I have a spring rest application where there are many endpoints.
As far as i understood node is lightweight. so can i deploy the application in node. If so, how to do it.
No, you can't.
You are comparing apples with oranges.
A Spring app is deployed inside a Java runtime.
Node.js is a Javascript runtime, a way to run Javascript code outside of the browser.
You cannot deploy Java applications inside a Javascript runtime.
Regarding the performance of a Java vs Javascript backend the answer is not straight forward.
It depends on the framework/libraries you are using and how you write the application code.
For an example, I have one angular ui project that fetches values and perform operations.
I have one backend API project in .Net Core and now I want to reuse angular ui project with node js.
Is it possible?
How to configure it and which are the main points to take care that angular project support both.
How can I deploy it?
Angular is a client side application that run's in clients browser, as long as the REST API or service you connect has Same API endpoints and same object models and authentication etc everything will work as intended.
REST is platform independent like the web services and also language independent. It doesn't matter if you use .Net Core or some nodejs framework.
Once the angular application is build ( ng build --prod) you get a bundled application files in dist folder you can host these files in any web sever just like you host normal html file.
The only change you have to make in the the Angular application will be to change the host URL (if there is any change) normally configured in environments folder
Take help of environment file and change the api as per your requirement.
I'm currently having a look at JHipster.
What I could not figure out is how JHipster handles environments like dev, testing and production.
This includes:
server (configs like db or other app specific configurations)
client (Angular4, configs like api endpoint)
In angular-cli projects I'm used to environment specific configuration files (environment.dev.ts, environment.prod.ts) that can be defined at build (ng build --env prod) but since angular.cli does not seem to be the prefered way on JHipster there must be another solution to this.
So my questions is:
how to configure environments (server and client)?
how to specify the environment (server and client) during build?
If you are creating a standalone application or using the JHipster gateway bundle architecture, you can parameterize your Angular 2 app through webpack by using DefinePlugin. I detailed the steps to this process here: Environment-based properties for Angular 2 App Served by Webpack?
JHipster packages the client within the server as an executable jar so there is no need for different API endpoints between different environments on client side as long as you use /api.
On server side, JHipster uses Spring profiles which can be set dynamically and point to external configuration files (application*.yml files). By default JHipster comes with 2 main profiles dev and prod, but there are also others like swagger and no-liquibase that you can combine with dev or prod. You can define your own profiles too.
If your client app needs to access some external API endpoints (e.g. Google) that are different between environments, you can do it in 2 ways:
- retrieve the active profiles from server API using /api/profile-info and then initializes your endpoints in client code.
- create a new endpoint in server (e.g. /api/configuration) to fetch your client configuration
Then there are 2 kind of builds triggered by maven/gradle profiles: dev and prod.
For a newcomer, the most important thing is probably to understand Spring Profiles and application properties, these are not specific to JHipster.
I have generated jhipster web-app, it comes with REST APIs.
Now, I would like to integrate an existing node.js application to jhipster web-app.
Is there a way to generate a rest-jhipster-client from existing jhipster app? Instead of manually creating functions and calls? Currently using node-rest-client for this
Thank you!
JHipster exposes your REST API documentation using swagger.
So you should look for swagger codegen to generate your client code from swagger JSON specification file, for your Jhipster app it is available at /v2/api-docs URL.
I'm not a nodejs expert but you could have a look at this one: https://www.npmjs.com/package/swagger-js-codegen