@@ -392,37 +392,67 @@ $ faas-cli template store list
392
392
$ faas-cli template store list -v
393
393
394
394
NAME SOURCE DESCRIPTION
395
- csharp openfaas Official C# template
396
- dockerfile openfaas Official Dockerfile template
397
- go openfaas Official Golang template
395
+ csharp openfaas Classic C# template
396
+ dockerfile openfaas Classic Dockerfile template
397
+ go openfaas Classic Golang template
398
398
...
399
399
` ` `
400
400
401
401
To get more details you can use the `--verbose` flag, or the `describe` command.
402
402
403
- Let's get a template for use with Node.js which is powered by the Express.js framework.
403
+ Let's find a Golang template with a HTTP format :
404
+
405
+ ` ` bash
406
+ faas-cli template store list | grep golang
407
+
408
+ golang-http openfaas Golang HTTP template
409
+ golang-middleware openfaas Golang Middleware template
410
+ ```
411
+
412
+ Then check out its upstream repository:
404
413
405
414
``` sh
406
- $ faas-cli template store describe node10-express
415
+ $ faas-cli template store describe golang-http
407
416
408
- Name: node10-express
417
+ Name: golang-http
409
418
Platform: x86_64
410
- Language: NodeJS
411
- Source: openfaas-incubator
412
- Description: NodeJS 10 Express template
413
- Repository: https://github.com/openfaas-incubator/node10-express -template
419
+ Language: Go
420
+ Source: openfaas
421
+ Description: Golang HTTP template
422
+ Repository: https://github.com/openfaas/golang-http -template
414
423
Official Template: true
415
424
```
416
425
417
426
Pull the template down:
418
427
419
428
``` sh
420
- $ faas-cli template store pull node10-express
429
+ $ faas-cli template store pull golang-http
430
+ ```
431
+
432
+ You can now create a function with this template by typing in:
433
+
434
+ ``` bash
435
+ faas-cli new --lang golang-http NAME
436
+ ```
437
+
438
+ To make it easier than having to run ` faas-cli template store pull golang-http ` for functions, you can append the following to your stack.yml file:
439
+
440
+ ``` yaml
441
+ configuration :
442
+ templates :
443
+ - name : golang-http
444
+ ` ` `
445
+
446
+ Then run the following instead of specifying the template name:
447
+
448
+ ` ` ` bash
449
+ $ faas-cli template store pull
421
450
```
422
451
423
- You can now type in `faas-cli new --lang node10-express`.
452
+ See also:
424
453
425
- See also : [Function & Template Store](https://github.com/openfaas/store/)
454
+ * [ OpenFaaS YAML reference guide] ( https://docs.openfaas.com/reference/yaml/ )
455
+ * [ Function & Template Store] ( https://github.com/openfaas/store/ )
426
456
427
457
### Variable Substitution in YAML File (optional exercise)
428
458
0 commit comments