Use Quarkus CLI
to scaffold a new Quarkus project based on Maven. Run the following command locally in the Terminal:
quarkus create app enter-serverless-function
The output looks like:
Creating an app (default project type, see --help).
-----------
applying codestarts...
📚 java
🔨 maven
📦 quarkus
📝 config-properties
🔧 dockerfiles
🔧 maven-wrapper
🚀 resteasy-codestart
-----------
[SUCCESS] ✅ quarkus project has been successfully generated in:
--> /YOUR_WORKING_DIR/enter-serverless-function
-----------
Navigate into this directory and get started: quarkus dev
First thing first! Run the Quarkus Dev Mode using the following Quarkus CLI:
cd enter-serverless-function
quarkus dev
The output looks like:
Listening for transport dt_socket at address: 5005
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
INFO [io.quarkus] (Quarkus Main Thread) enter-serverless-function 1.0.0-SNAPSHOT on JVM (powered by Quarkus xx.xx.xx.Final) started in 1.612s. Listening on: http://localhost:8080
INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]
--
Tests paused
Press [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>
Press r
to start the continuous testing then press d
to open a DEV UI. It will open a new web browser then access to DEV UI.
You’ll also see All tests passed
on the right bottom that points the result of the continuous testing.
When you select the down arrow on the left bottom, you will see the readonly log terminal.
Select Continuous Testing
menu on the left, you will see the same testing result as you saw in your terminal.
Verify the RESTful API if it works well. For example, use HTTPie to invoke the endpoint in your local terminal:
http :8080/hello
The output should be:
HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
content-length: 28
Hello from RESTEasy Reactive
You can also use curl
command to access the endpoint:
curl localhost:8080/hello
Keep running your Quarkus dev mode!!