Fn supports grouping functions into a set that defines an application (or API), making it easy to organize and deploy.
This part is easy, just create an app.yaml file and put a name in it:
mkdir myapp2
cd myapp2
echo 'name: myapp2' > app.yamlThis directory will be the root of your application.
The root function will be available at / on your application.
fn init --runtime rubyNow we have a Ruby function alongside our app.yaml.
Now let's create a sub route at /hello:
fn init --runtime go helloNow we have two functions in our app. Run:
lsTo see our root function, our app.yaml and a directory named hello.
Now we can deploy the entire application with one command:
fn deploy --all --localOnce the command is done, let's surf to our application:
- Root function at: http://localhost:8080/r/myapp2/
- And the hello function at: http://localhost:8080/r/myapp2/hello
Congratulations! In this tutorial you learned how to group functions into an application and deploy them with a single command.
Go: Back to Contents

