mba12
mba12

Reputation: 2792

How to add a custom Restful web service in JHipster?

I'm new to Jhipster and looking through the documentation I see creating a service here: https://jhipster.github.io/creating-a-service/ but nothing on adding a simple, secured, custom web service.

I've successfully added an entity and can access (i.e. curl) the data with the command given in the swagger description. I'd like to augment that default service and add a second custom service that tweaks the json format returned. Is there an easy way to do that?

Upvotes: 2

Views: 2553

Answers (1)

Plog
Plog

Reputation: 9622

jHipster starts you off by providing you with all the basic CRUD methods for a given entity that you generated through jHipster. All that creating a service does is provides you with a separate service layer so that calls to the repository are not done directly from the controller.

If you want to write a more specific service other than simple CRUD for your entity then you will need to manually write this code in the controller and service layer yourself. jHipster just gives you a very good starting point. It can't do everything!

If however like you are saying you just want to 'tweak the json format returned' then this seems to me like you just want to edit your entities. If you already created an entity called foo then you can update its parameters using

jhipster entity foo

In your command line.

Upvotes: 2

Related Questions