You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cli/templates.md
+42-31Lines changed: 42 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -429,6 +429,48 @@ npm i --save cheerio
429
429
430
430
You can now add a `require('cheerio')` statement into your function and make use of this library.
431
431
432
+
433
+
#### Java
434
+
435
+
Two Java templates are provided `java11` and `java11-vertx`, both of which use Gradle as the build system. Please note that the `java8` template is deprecated, and should not be used.
436
+
437
+
> If you need a different version, then please fork the templates repository, or contact sales@openfaas.com to access additional templates via your OpenFaaS Premium Subscription.
438
+
439
+
Support is made available for external code repositories via the build.gradle file where you specify dependencies to fetch from repositories or JAR files to be added via the build.
440
+
441
+
* Write a function `java-function`:
442
+
443
+
```
444
+
$ faas-cli new --lang java11 java-function
445
+
```
446
+
447
+
* Write your code in:
448
+
449
+
./src/main/Handler.java
450
+
451
+
* Write `junit` tests in:
452
+
453
+
./src/tests/
454
+
455
+
* Update gradle config if needed in:
456
+
457
+
./build.gradle
458
+
./settings.gradle
459
+
460
+
* Working with headers (advanced)
461
+
462
+
You can view the code for the IRequest and IResponse in [the OpenFaaS templates-sdk](https://github.com/openfaas/templates-sdk/tree/master/java11/model/src/main/java/com/openfaas/model)
463
+
464
+
You can use `getHeader(k)` on the Request interface to query a header.
465
+
466
+
To set a header such as content-type you can use `setHeader(k, v)` on the Response interface.
467
+
468
+
You can also run the following to create a function using Vert.x
469
+
470
+
```bash
471
+
$ faas-cli new --lang java11-vertx java-vertx-function
472
+
```
473
+
432
474
#### CSharp / .NET Core 2.1
433
475
434
476
You can create functions in .NET Core 2.1 using C# / CSharp.
Two Java templates are provided `java8` and `java12`, if you need a different version, then please fork the templates repo or request it from the community.
528
-
529
-
Support is made available for external code repositories via the build.gradle file where you specify dependencies to fetch from repositories or JAR files to be added via the build.
530
-
531
-
* Write a function`java-function`:
532
-
533
-
```
534
-
$ faas-cli new --lang java8 java-function
535
-
```
536
-
537
-
* Write your code in:
538
-
539
-
./src/main/Handler.java
540
-
541
-
* Write `junit` tests in:
542
-
543
-
./src/tests/
544
-
545
-
* Update gradle config if needed in:
546
-
547
-
./build.gradle
548
-
./settings.gradle
549
-
550
-
* Working with headers
551
-
552
-
You can use `getHeader(k)` on the Request interface to query a header.
553
-
554
-
To set a header such as content-type you can use `setHeader(k, v)` on the Response interface.
555
-
556
567
#### PHP7
557
568
558
569
To create a PHP7 functionnamed`my-function`type in:
0 commit comments