Updated docs.

This commit is contained in:
Travis Reeder
2017-09-18 17:06:02 -07:00
parent 5476665ea9
commit 87deba45e2
10 changed files with 105 additions and 11 deletions

63
docs/developers/apps.md Normal file
View File

@@ -0,0 +1,63 @@
# Applications
In `fn`, an application is a group of functions with path mappings (routes) to each function ([learn more](model.md)).
We've tried to make it easy to work with full applications by providing tools that work with all the applications functions.
## Creating an Application
All you have to do is create a file called `app.yaml` in your applications root directory, and the only required field is a name:
```yaml
name: myawesomeapp
```
Once you have that file in place, the `fn` commands will work in the context of that application.
## The Index Function (aka: Root Function)
The root app directory can also contain a `func.yaml` which will be the function access at `/`.
## Function paths
By default, the function name and path will be the same as the directory structure. For instance, if you
have a structure like this:
```txt
- app.yaml
- func.yaml
- func.go
- hello/
- func.yaml
- func.js
- users/
- func.yaml
- func.rb
```
The URL's to access those functions will be:
```
http://abc.io/ -> root function
http://abc.io/hello -> function in hello/ directory
http://abc.io/users -> function in users/ directory
```
## Deploying an entire app at once
```sh
fn deploy --all
```
If you're just testing locally, you can speed it up with the `--local` flag.
## Deploying a single function in the app
To deploy the `hello` function only, from the root dir, run:
```sh
fn deploy hello
```
## Example app
See https://github.com/fnproject/fn/tree/master/examples/app for a simple example.

31
docs/developers/model.md Normal file
View File

@@ -0,0 +1,31 @@
# Object Model
This document describes the different objects we store and the relationships between them.
## Applications
At the root of everything are applications. In `fn`, an application is essentially a grouping of functions
with path mappings (routes) to each function. For instance, consider the following URLs for the app called `myapp`:
```
http://myapp.com/hello
http://myapp.com/users
```
This is an app with 2 routes:
1. A mapping of the path `/hello` to a function called `hello`
1. A mapping of the path `/users` to a function called `users`
## Routes
An app consists of 1 or more routes. A route stores the mapping between URL paths and functions (ie: container iamges).
## Calls
A call represents an invocation of a function. Every request for a URL as defined in the routes, a call is created.
The `call_id` for each request will show up in all logs and the status of the call, as well as the logs, can be retrieved using the `call_id`.
## Logs
Logs are stored for each `call` that is made and can be retrieved with the `call_id`.