The Java11-Vert.x template uses gradle as a build system.
Gradle version: 4.8.1
There are two projects which make up a single gradle build:
- function - (Library) your function code as a developer, you will only ever see this folder
- entrypoint - (App) Vert.x HTTP server
The handler is written in the ./src/main/java/com/openfaas/function/Handler.java folder
Tests are supported with junit via files in ./src/test
External dependencies can be specified in ./build.gradle in the normal way using jcenter, a local JAR or some other remote repository.
This template allow you to serve static html assets (eg: single page application)
You only need to add to the environment key, a FRONTAPP variable (with a value set to true)
environment:
FRONTAPP: truePut your static assets in this directory: /src/main/resources/webroot
If
FRONTAPPis set tofalse(or does not exist), it's theHandlerinstance that serves the data.
provider:
name: faas
gateway: http://openfaas.test:8080
functions:
hello-vert-x:
lang: java11-vert-x
environment:
FRONTAPP: true
handler: ./function
image: registry.test:5000/hello-vert-x:latest