node.js REST client for JHipster application - node.js

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

Related

Can I use JHipster to create a react frontend with a microservice backend?

With jhipster I can use the monolith style application to create a react frontend that calls into a spring backend. Is there a way to create a react frontend that calls in to a microservice backend?
Not sure how I'd missed this but the answer is here https://www.jhipster.tech/creating-microservices/
Generating entities in a microservices architecture
Using the entity sub-generator works a little bit differently in a microservices architecture, as the front-end and the back-end codes are not located in the same application.
First, generate the entities in the microservices applications: this works as usual, and you can also use JHipster UML or JDL Studio to help you generate complex entities and relationships. As microservices don’t have a front-end, no Angular/React code will be generated.
Then, on the gateway(s), run the entity sub-generator again. A new question will appear at the beginning, which is specific to gateways:
You will have the choice either to generate an new entity normally (a gateway is also a standard JHipster application, so this would work like for a monolith application), or use an existing JHipster configuration from a microservice.
If you choose to generate the entity from a microservice, you will need to enter the path to this microservice on your local computer, and then JHipster will generate the front-end code on the gateway.

Undestanding the flow of swagger UI

I am trying to mock the REST API using swagger.. I currently created nodejs project in which the default js appreas which is hello_world.js in ./api/controllers/hello_world.js.
Now I want to create a new controller and want to refer that to my YAML, that is from swaggerUI.. How can I do it? Any link would be much useful.
I am only mocking APIS, not developing.
Many thanks in advance.
Checkout the swagger codegen project, which generates server stubs based on the api specification. Node.js is among the supported languages: https://github.com/swagger-api/swagger-codegen

How do i integrate jhipster with Stormpath

I am trying to use jhipster. The sample works nice out of the box.
I want to configure it to use Stormpath User management - https://github.com/stormpath/stormpath-spring-security/wiki
I could not find any blog/article on ensuring the Spring Server and AngularJS Client both use StormPath.
check this out-> JHipster sub-generator.
Have a look at this fork. i used it in my project and it works quite good.
https://github.com/moifort/generator-jhipster/tree/user-managment

Sails.js API documentation

I want to develop an API using the MVC pattern. I found sails framework interesting and I'd like to know if it's possible to configure swagger or something like with sails to generate the documentation of my API (something like swagger-express for express for example).
Thanks!
This feature is in progress. If you'd like to help out, we can all collaborate here: https://github.com/balderdashy/sails/issues/1094
Update (August 2015):
Check out this Sails Hook that offers native Swagger integration. It compiles all of the bound routes in Sails, and generates a Swagger 2.0 document: https://github.com/tjwebb/sails-swagger
Here is what I did to have my documentation work with sails.js : you can download swagger-ui here : https://github.com/swagger-api/swagger-ui or via npm (npm install swagger-ui).
Then in the assets folder of your sails project, create a folder that points to the swagger folder ("docs" for example, so you'll be able to access to your documentation via your_url:port/docs)

Can we have multiple subapi with Swagger?

I'm developing a system with nodeJS and I use requireJS and swagger.
Now, I'm preparing to create new version of my site.
Can we have multiple subapi with swagger.
I mean, currently my swagger api is located at localhost:2052/docs and I want my system have 2 apis:
localhost:2052/docs and
localhost:2052/v2.0/docs
Is it possible with swagger, if yes, how?

Resources