Enable jhipster project cache - jhipster

I have created a j-hipster project without cache support. Now I want to enable cache for the that project.
How it could be done ? or is it possible to enable it after we create project.

You can add cache support after creating the project by adding "cacheProvider": "<CacheYouWant>" in your .yo-rc.json and generate the project again with jhipster --force. You can also enable the Hibernate cache by adding "enableHibernateCache": <boolean> (it is disabled if you choose Memcached).
Check out here to have more information about cache systems in JHipster
https://www.jhipster.tech/using-cache/

Related

How to remove db initialization and connection step/code from JHipster microservice app?

I have created java microservices app using JHipster with options jwt, mysqldb, elastic search etc.., I want to remove db related stuff. I just want to use this searvice for indexing user given data to elastic search and apply search on it.
I'm new to java and so need help to remove db related stuff from this kind of app. Please help
You can try to edit .yo-rc.json file from your project, and change "databaseType": "sql" to "databaseType": "no" and re-generate your app using yo jhipster but there's no guarantee that it will work as "no db + ElasticSearch" is probably not a supported use case.
You may have also to remove "devDatabaseType" and "prodDatabaseType".
To be safer, you should rather copy your modified .yo-rc.json file to an empty directory and run yo jhipster from there.

adding social login to exising JHipster app

I've been developing a JHipster app for a number of days and I realize now that it was initially created without the Social login option. What is the best approach for adding it after the fact? Can I simply add "enableSocialSignIn": true to .yo-rc.json and re-run yo jhipster (everything is checked into git), or are the changes too significant?
Rather than clobber my app, I ended up creating a new temporary JHipster app, doing a diff of the two apps, and selectively copying over only the code that pertained to social logic (and eliminating the code that pertained to OAuth2, since I also switched to session based / spring security authentication as well).

JHipster - Can I add websocket support to my existing generated application?

I have an existing JHipster application that was generated without adding the websocket option. A need has come about for this functionality to be added to the application for a realtime data view, is there a way to bolt this functionality into my existing generated app?
I tried adding toggling on the websocket: false value in the .yml file and re-running yo jhipster but this did not add in any new files and the example user tracker was not added into the project so assuming this cannot be accomplished this way
Thanks
The generator is looking for settings in the .yo-rc.json file which is located at root level in the folder of your app. Depending on your IDE it can be that is not shown and you need to show it over otehr perspective or to view it in a terminal/cmd.
In the .yo-rc.json you will need to change the value of the websocket property from no to spring-websocket i.e.
"websocket": "spring-websocket",
Now when you run your generator it should generate the parts need it for websockets. Also have a look at the jhipster doc for websockets

"Fody not properly installed" error exception. (Xamarin.forms)

I'm making app with using Xamarin.forms. (PCL Project)
Today, I added new three solution packages named SVG.Forms.Plugin.Abstractions, SVG.Forms.Plugin.iOS, SVG.Forms.Plugin.Android on workspace that downloaded from github.
I have used realm for Xamarin.
But After I added new packages, "Realms.RealmException has been thrown".
Message is "Fody not properly installed. allbX.Baby is a RealmObject but has not been woven."
Is it Fody's problem or Realm's or new packages'(SGV Control)?
And could you let me know how to solve it?
Better Answer
The check which is delivering that message is because Fody is not running.
So, they may have a RealmObject in their component but Fody doesn't get run building in your solution so weaving doesn't occur.
The easiest fix is to just use NuGet to add Fody to your main application project. That should install it in the right place for the solution.
Background
NuGet manages dependencies so if a package relies on Realm, it will go on in turn and install Realm. Realm itself relies on Fody, for example, so will in turn trigger a Fody installation.
You can manually install Realm but it is a little fiddly, having to add a couple of lines to your csproj to specify imports. We have chosen to only document installation via NuGet at this stage.
If you want to manually add Realm to another solution without using NuGet, I suggest you take a new clean solution, save a copy, and diff with the changes made to that solution by adding Realm via NuGet. You will then see the lines to copy into your existing solution.

what's the best way to implement loopback on an existing node.js project

I have successfully created a few loopback projects using
slc lb project *myproject*
command but now I have a pre-existing node project that I would like to use loopback in.
Is there a recommended best practice around the migration to loopback?
Is it just a matter of including the relevant module references in my package.json and running npm install? Or do also need to make some changes to my app.js?
Will I need to manually create the models.json and datasources.json?
Any insignts appreciated.
Edit: I added the relevant loopback modules to my package.json, replaced my express requires with loopback, manually added a datasources.json, and models.json and it all seems to have worked.
The only remaining issue is that when I bring up my explorer view the shell comes up but no api endpoints even though I have models defined in my models.json file.
Edit: I added the relevant loopback modules to my package.json, replaced my express requires with loopback, manulally added a datasources.json, and models.json and it all seems to have worked.
The only remaining issue is that when I bring up my explorer view the shell comes up but no api end points even though I have models defined in my models.json file.
To load and process models.json and datasources.json, you have to "boot" your LoopBack application.
Assuming you have installed loopback 2.x in your project, and you want to use the old 1.x project layout scaffolded by slc lb, here are the instructions:
Install loopback-boot 1.x. Make sure you are not using 2.x or newer, as 2.x changed the project layout.
npm install --save loopback-boot#1.x
Modify your main application file (e.g. app.js) and add the following lines:
// at the top
var boot = require('loopback-boot');
// after you have created `app` object
// and configured any request-preprocessing middleware
boot(app, __dirname);
Please consider using the new 2.x project layout, see Migrating apps to version 2.0 for information on how to migrate your "models.json" into the new format.
Is there a recommended best practice around the migration to loopback?
I suggest scaffolding a new app using slc loopback and moving your old apps files to the relevant directories.
is it just a matter of including the relveant module references in my package.json and running npm install or do also need to make some changes to my app.js?
This will be part of the migration process, you will also need to configure app.js to meet your needs (like setting up middleware, etc)
will I need to manually create the models.json and datasources.json?
No, when you scaffold the app using slc loopback, they will be automatically generated in the new project.
The only remaining issue is that when I bring up my explorer view the shell comes up but no api end points even though I have models defined in my models.json file.
Did you create the files in commmon/models manually? Try creating them through slc loopback:model and the tool will add the configurations in server/model-config.json for you.

Resources