Posts

Showing posts with the label Quarkus

Quarkus and Qute Templating Engine: File Upload, Listing, Download & Delete Example

Image
Here is an example of a Quarkus application that implements file upload, listing, downloading, and deleting files using Quarkus Qute templating engine: 1. Add Dependencies to pom.xml <dependencies> <dependency> <groupId> io.quarkus </groupId> <artifactId> quarkus-qute </artifactId> </dependency> <dependency> <groupId> io.quarkus </groupId> <artifactId> quarkus-resteasy-reactive </artifactId> </dependency> <dependency> <groupId> io.quarkus </groupId> <artifactId> quarkus-vertx-web </artifactId> </dependency> <dependency> <groupId> io.quarkus </groupId> <artifactId> quarkus-smallrye-mutiny </artifactId> </dependency> </dependencies> 2. Create a File Resource Class for Upload, List, Download, and Delete operations import ...

Deploy a Quarkus App for Free on Railway (No Credit Card)

Image
To deploy a Quarkus app on Railway (For free registration click here ), you need to follow these steps: 1. Prepare your Quarkus Application Ensure that your Quarkus app is working locally. You can test this by running: ./mvnw quarkus: dev Make sure it works as expected before deploying. 2. Set Up Railway Project If you don’t already have a Railway account, sign up at Railway ( click here for registration). Once logged in, create a new project on Railway. 3. Push Your Quarkus App to GitHub Railway can integrate with GitHub to deploy your app automatically. Push your Quarkus project to a GitHub repository if it's not already there. 4. Create a New Railway Project In your Railway dashboard, click on "New Project." Choose the GitHub integration and connect it to your GitHub repository. Select the repository containing your Quarkus app. 5. Add a Railway Deployment Configuration Railway automatically detects Java applications and uses the appropriate buildpack. However, you m...

Custom Exception Handling in Quarkus REST API

Image
In this section, we will learn how to handle exceptions in the Quarkus REST application using ExceptionMapper interface implementations. ExceptionMapper is a contract for a provider that will map a thrown application exception to a Response object. We will show you custom exception handling with the help of a simple application, Final  Project Directory: Complete pom.xml  <?xml version = "1.0" ?> <project     xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0     https://maven.apache.org/xsd/maven-4.0.0.xsd"     xmlns = "http://maven.apache.org/POM/4.0.0"     xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" >     <modelVersion> 4.0.0 </modelVersion>     <groupId> org.knf.dev.demo </groupId>     <artifactId> quarku-custom-exception-handling </artifactId>     <version> 1.0.0-SNAPSHOT </version>     <properties> ...