Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vert-x template #192

Merged
merged 1 commit into from
Jan 29, 2020
Merged

Add vert-x template #192

merged 1 commit into from
Jan 29, 2020

Conversation

alexellis
Copy link
Member

Based upon the existing java8/11 template and the work of @k33g

https://gitlab.com/openfaas-experiments/java-8-vert-x-template/

Signed-off-by: Alex Ellis (OpenFaaS Ltd) alexellis2@gmail.com

Example handler:

package com.openfaas.function;

import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.handler.BodyHandler;
import io.vertx.core.json.JsonObject;

public class Handler implements BodyHandler {

  @Override
  public void handle(RoutingContext routingContext) {
    routingContext.response()
      .putHeader("content-type", "application/json;charset=UTF-8")
      .end(
        new JsonObject()
          .put("status", "ok")
          .encodePrettily()
      );
  }

  @Override
  public BodyHandler setBodyLimit(long bodyLimit) {
    return null;
  }

  @Override
  public BodyHandler setUploadsDirectory(String uploadsDirectory) {
    return null;
  }

  @Override
  public BodyHandler setMergeFormAttributes(boolean mergeFormAttributes) {
    return null;
  }

  @Override
  public BodyHandler setDeleteUploadedFilesOnEnd(boolean deleteUploadedFilesOnEnd) {
    return null;
  }

}

Based upon the existing java8/11 template and the work of @k33g

https://gitlab.com/openfaas-experiments/java-8-vert-x-template/

Tested by creating a new function with `faas-cli new` and then
running `faas-cli up` against a Kubernetes cluster with OpenFaaS.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@alexellis alexellis force-pushed the openfaasltd/add-vert-x branch from 77a9e9e to ddf6caa Compare January 29, 2020 12:47
@alexellis alexellis merged commit 70eda00 into master Jan 29, 2020
@alexellis alexellis deleted the openfaasltd/add-vert-x branch January 29, 2020 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant