[id="serverless-create-func-kn_{context}"]
= Creating functions

You can create a basic serverless function using the `kn` CLI.

You can specify the path, runtime, and template as flags on the command line, or use the `-c` flag to start the interactive experience in the terminal.

.Procedure

* Create a function project:
+
[source,terminal]
----
$ kn func create <path> -l <runtime> -t <template>
----
** Supported runtimes include `node`, `go`, `python`, `quarkus`, and `typescript`.
** Supported templates include `http` and `events`.
+
.Example command
[source,terminal]
----
$ kn func create -l typescript -t events examplefunc
----
+
.Example output
[source,terminal]
----
Project path:  /home/user/demo/examplefunc
Function name: examplefunc
Runtime:       typescript
Template:      events
Writing events to /home/user/demo/examplefunc
----

[id="serverless-create-func-kn_{context}"]
= Creating functions

You can create a basic serverless function using the `kn` CLI.

You can specify the path, runtime, template, and repository with the template as flags on the command line, or use the `-c` flag to start the interactive experience in the terminal.

.Procedure

* Create a function project:
+
[source,terminal]
----
$ kn func create -r <repository> -l <runtime> -t <template> <path>
----
** Supported runtimes include `node`, `go`, `python`, `quarkus`, and `typescript`.
** Supported templates include `http` and `events`.
+
.Example command
[source,terminal]
----
$ kn func create -l typescript -t events examplefunc
----
+
.Example output
[source,terminal]
----
Project path:  /home/user/demo/examplefunc
Function name: examplefunc
Runtime:       typescript
Template:      events
Writing events to /home/user/demo/examplefunc
----
+
** Alternatively, you can specify a repository that contains a custom template.
+
.Example command
[source,terminal]
----
$ kn func create -r https://github.com/boson-project/templates/ -l node -t hello-world examplefunc
----
+
.Example output
[source,terminal]
----
Project path:  /home/user/demo/examplefunc
Function name: examplefunc
Runtime:       node
Template:      hello-world
Writing events to /home/user/demo/examplefunc
----

Document the -r <repository> option of the `kn func create` command
Document the -r <repository> option of the `kn func create` command

Change argument order in a command
