first of all I am new to Jhipster. I have created jhipster gateway (Frontend) with angular without application (backend).
I was expecting that this will not work as backend is not present/working and all service calls will go through backend to access db.
When I am trying to access frontend using http://localhost:8080, I can see everthing is working. I am not sure how. can someone explain?
JHipster v6.10.5 is used for this.
Thanks
Shirish
Application responses for JHispter commandline:
? Which *type* of application would you like to create? Microservice gateway
? [Beta] Do you want to make it reactive with Spring WebFlux? No
? What is the base name of your application? gateway
? As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port conflicts. 8080
? What is your default Java package name? com.btn.test
? Which service discovery server do you want to use? JHipster Registry (uses Eureka, provides Spring Cloud Config support and monitoring dashboards)
? Which *type* of authentication would you like to use? JWT authentication (stateless, with a token)
? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
? Which *production* database would you like to use? MySQL ? Which *development* database would you like to use? MySQL
? Do you want to use the Spring cache abstraction? Yes, with the Hazelcast implementation (distributed cache, for multiple nodes, supports rate-limiting for gateway applications)
? Do you want to use Hibernate 2nd level cache? Yes
? Would you like to use Maven or Gradle for building the backend? Maven
? Which other technologies would you like to use?
? Which *Framework* would you like to use for the client? Angular
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Default JHipster
? Would you like to enable internationalization support? No
? Besides JUnit and Jest, which testing frameworks would you like to use? Gatling, Cucumber, Protractor
? Would you like to install other generators from the JHipster Marketplace? (y/N) No
emp.jdl
/**
* The Employee entity.
* #author Shirish Bathe
*/
entity Employee {
name String required unique
dept String
}
Now I have access gateway using http://localhost:8080 and tried to access employee entity. I am able to see (fake) data in a table.
Hence Even if backend application is not present, application is working fine. how? Am I missing anything?
The gateway contains the whole UI. The microservices come into play when you define entities. These are not managed by the gateway (but the UI is). This overview pictures describes the architecture quite well:
https://www.jhipster.tech/microservices-architecture/
Related
I have developed my ethereum smart contract and I want to integrate it with my web application. But I don't know that is integration with ReactJS a better option or integration with nodejs a better one. Please give suggestions . Also I don't know how to do integration with backend through web3 library so please guide me about that.
When you are creating web3 app , most of the time you are not going to need a backend for that (Although you need a server to host your website) .
Working with and managing smart contracts are very easy at the front-end and there is no need for backend, but if your working on a large scale project , you are definitely going to need a backend for handling complex logics .
Next js is best option for both of that , containing node and react , also no need for manually configuring web server.
Better is next.js. I explained it here: https://ethereum.stackexchange.com/questions/129547/next-js-versus-react-which-to-use-when-for-your-dapp/130040#130040
Not every browser has metamask extension. By using next.js, when our
code is taken and rendered on the server, on the next server we can
reach out to the Ethereum network and do some initial calls like data
fetching, or alist of items in your smart contract. we execute all of
those requests on the server. That means when next.js produces Html
documents to send down to the user browser, it does not matter whether
or not users are using metamask. It does not matter whether or not
they have access to an Ethereum network. Because we already take care
of the data fetching for them. So all the users out there who are not
using metamask are going to see some information on the screen.
You've mentioned that you don't want to switch technologies, and while I agree with NextJS being a good platform to develop dApps on, I suggest you just use your current NodeJS server for anything that isn't web3 related and you use the web3js library from the frontend (your React) which would be very similar to a NextJS app anyway.
This way you don't have to switch technologies.
I have a web site that frontend developed by vue.js(SPA) and backend developed by node.js. I want to use Elasticsearch in the search box at main page. Should I call search query from client to elasticsearch or client to nodejs backend and then to elasticsearch?
What is the best practice? What are the pros and cons?
Calling it from front end takes you to expose your ES server in the public network. You get in security risks such as exposing your database.
Calling it from backend avoids public network exposition and also give you a chance to implement a controller to handle search validations and reponse status.
In my personal experience the backend way is better for ES queries.
refs:
https://discuss.elastic.co/t/is-it-safe-to-expose-elasticsearch-to-the-internet/246862/5
https://discuss.elastic.co/t/is-it-safe-to-expose-elasticsearch-to-the-internet/247041
I am trying to build a react-native application and to do so, I am following this tutorial : https://www.youtube.com/playlist?list=PLB97yPrFwo5hMR8znwt0NqgmmqzoPemnT
My application is like a form. People must enter some data into some fields and they will be sent into a database. People can later see their form from the application. So it is like simple a CRUD todo list application.
However, I do not want to use on-demand cloud computing platforms (AWS, GCP, OVH, ...) to store my data. I have my own server at home (NUC Intel) and want to use it as the application's server (store the data in there).
On my server I want to have a mongodb database and make it available from any computers that request it with the correct credentials. I would add firewalls as well for security.
This way, the react native application will be able to access read and write from this database wherever they are in the world as long as they have internet available.
As my backend I will use nodejs and express.
As my front end React Native and Redux.
Any ideas or tutorials I could follow ? I have been looking a lot but all the tutorials end by storing their database in GCP or AWS ... So is it possible to access mongodb database from a different network? Or would MySQL be a better solution?
I'm a node/JS beginner, so really sorry if I missed something.
My Need is the following, I have a Swagger/OpenAPI3.0 yaml file describing an API that I need to consume. As the client will be an Node API gateway, I want this API Client code for Node.
I use the Swagger Editor to generate client like this :
Screenshot of Swagger Editor
But the generated code seems dedicated to browser client and I need to refactor this to have it works properly with node.
Does it exist an alternative?
Thanks a lot for your help.
One of the libraries which can create a TypeScript API client for Node.js at runtime from an OpenAPI v3 definition is called openapi-client-axios.
following the explanation on separating frontend and gateway, I created two JHipster applications:
Gateway using jhipster --skip-client
Frontend using jhipster --skip-server --db --auth uaa --uaa-base-name uaa-server
When using Swagger-UI, I can use the default API and the API of my UAA server. I can also see in the drop-down menu my micro-services but when selecting them, I get an error message :
Can't read swagger JSON from http://127.0.0.1:9000/myservice/v2/api-docs
What is wrong in my configuration ? What did I forget ?
[EDIT] I finally found, see below
The second question is about the communication between frontend and gateway when both are running on different machines.
Authentication seems to be correct when looking at UAA server but frontend side receives a 403 code. It seems to be a problem with CSRF but I don't know how to handle it.
What's the way to deal with CSRF in JHipster ?
PS : I'm pretty sure I will also have problem when making to microservices talk together :)
Added contexts for proxying in webpack.dev.js and it seems to be working.