When you come to defining security in your project, there’s always two points to consider: how to secure the app, and how to handle security from a frontend(whether it’s web ui, mobile or other types).
We already created some basic API and consumed it with Swagger on your React app. It’s now time to define security and authentication method.
This article covers:
Define simple JWT security on Quarkus backend
Use Quarkus OpenAPI annotations to define authentication method
Next, remove GreetingResource.java and test folder(unit tests are a good thing to your project, but because we won’t write unit test we can just remove them for now). You can also remove resource/META-INF folder as well.
Add next two lines to application.properties. We want to still see error messages and we assume that our tool won’t be used in a pipe with other tool (e.g if qpm host | curl - will return error it will fail the curl call which is okay for us)
Adding root command
Every middle+ command-line tool developed in Picocli will require root(or top) command. This command will aggregate all the other commands and serve as entry point for parsing our command line
We’ll need to create QdmCommand in root package location
It’s empty Runnable class and it’s okay.
@TopCommand notifies Quarkus that it’s entry point for our CLI tool
@Command is a Picocli interface that marks the current class as a command. You can read more here
mixinStandardHelpOptions specifies that we want Picocli to generate help options for us. This will automatically add --help option
in version we specify current version of app, there’s also versionProvider, but we won’t cover it in this article
You can do next now:
./mvnw clean package -Pnative
Implement upgrade command
Now we have basic skeleton to start implementing specific commands. For this article, we’re only interested in qdm upgrade method. This function will upgrade your Quarkus project to latest version
Here’s simple and complete code:
We have few different options to pass into our upgrade command.
--releaseUrl specifies where to look for latest release, by default it looks for github releases
-v or --version allows you to specify your own version, e.g 1.5.0.Final
-f or --file allows you to specify pom.xml location. By default, it looks for the current folder.
Other logic in class makes a request to GitHub, looks for properties in pom.xml and replaces the required properties. The only thing is that we have GithubRelease.java which showed below
Initialize a full-stack app is an easy task. Connect two seamlessly is a bit trickier. You can call /hello endpoint without any Swagger or other libraries. But when you have, say, 20 endpoints to work with, it’s good to standardize your API calls.
This article covers:
More complex than /hello REST API on Quarkus that will be used by our frontend
Setup Swagger both on Quarkus and React
Create Networking React class that will be used to fetch our data
For a long time JHipster used Spring for all the backend logic, once I started to work with Quarkus I always though how it could be great to have a way to generate Quarkus project with Jhipster. And we finally have it!
In this article, I’ll show you how to generate a new JHipster Quarkus project with angular frontend and complex entity logic with relationships, pagination, and security in just a few minutes. I’ll also guide you through the project structure.
Every significant app will have security. And you probably opened this article because you’re looking for some simple yet durable solution. What can be simpler yet good enough as JWT Token authorization? Official Quarkus website already covered this topic, but I’ll show the most popular use-case for it, that is, generation of the token when the user logs in. I’ll show you a more abstract solution that you can plug-in to any app and generate a token with a single line of code in your /login method.
Many services usually serve some web UI, whether it’s an admin tool, complete portal, or just a single HTML page. Vuejs is a perfect tool that can help you build single-page applications. Why not integrate it tightly with Quarkus?
The App Engine is not a tool for “lazy” developers. It’s more than just an easy way to deploy your app. App Engine covers scaling, availability, logging and more.
For more then 4 years, I was super skeptical about such solutions, in my eyes they were “limiting” your architecture freedom. Few months ago, I realized how wrong I was. Let me show you small example that I had to scale once.
GraphQL is both a language and a tool that can simplify your API and save some development hours to your project because you don’t need to create different endpoints for single data structure. With Quarkus, it can be done really easily with vertx extension.
Let’s start with a simple example. You have a simple service that returns project teams and users for them. You’ll need:
Create endpoint to get all teams + create an endpoint to get a single team
Create an endpoint that will give you all users of a team.
Alternatively, you can use ORM to return teams with users in them as a one large result
An endpoint that will only return teams with users, but users only have a name.
I included #4 because you might have some really large object(imagine that user has 200 fields, and you return thousands of them. And your clients only need their names to display in a search result.
If you’re looking for Microprofile GraphQL(the one with annotation support) please follow to official Quarkus guide.
After this article, you’ll be able to write beautiful command-line tools for Quarkus with Picocli. This is the continuation of the first article about Quarkus mode, if you haven’t seen it, please read it first.
Now that you know how to use command mode, it’s time to prettify it! We gonna use Picocli, which makes cli tools fun to build.