Skip to content

Commit

Permalink
add missing help files
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Dec 15, 2017
1 parent 00dd3f8 commit 07bffab
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 16 deletions.
12 changes: 12 additions & 0 deletions public/fusio/help/action/file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

## File

Path to a simple static json file. Fusio will simply forward the content to
the client. This is helpful if you want to build fast an sample API with dummy
responses.

### Example

```
/tmp/static.json
```
20 changes: 20 additions & 0 deletions public/fusio/help/action/http.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

## HTTP

Contains a HTTP url. Fusio automatically adds some additional headers to the
request which may be used by the endpoint i.e.:

```http
X-Fusio-Route-Id: 72
X-Fusio-User-Anonymous: 1
X-Fusio-User-Id: 4
X-Fusio-App-Id: 3
X-Fusio-App-Key: 1ba7b2e5-fa1a-4153-8668-8a855902edda
X-Fusio-Remote-Ip: 127.0.0.1
```

### Example

```
http://foo.bar
```
30 changes: 30 additions & 0 deletions public/fusio/help/action/php.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

## PHP

Path to a PHP file. Fusio simply includes this file on execution. In the
following an example implementation:

```php
<?php
/**
* @var \Fusio\Engine\ConnectorInterface $connector
* @var \Fusio\Engine\ContextInterface $context
* @var \Fusio\Engine\RequestInterface $request
* @var \Fusio\Engine\Response\FactoryInterface $response
* @var \Fusio\Engine\ProcessorInterface $processor
* @var \Psr\Log\LoggerInterface $logger
* @var \Psr\SimpleCache\CacheInterface $cache
*/

// @TODO handle request and return response

$response->build(200, [], [
'message' => 'Hello World!',
]);
```

### Example

```
/tmp/Todo/collection.php"
```
27 changes: 11 additions & 16 deletions public/fusio/help/action/v8.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@

## V8

Fusio uses the V8 engine to offer a simple javascript API to implement the
endpoint logic. More detailed information about the [v8 API](http://www.fusio-project.org/documentation/v8)
at the website.
Contains javascript code. Fusio uses the internal v8 engine to execute the js
code. This is suitable for javascript developers who like to write the code in
[javascript](http://www.fusio-project.org/documentation/v8). Note the v8
implementation requires the [php v8](https://github.com/pinepain/php-v8)
extension.

### Example

var id = request.getUriFragment('id');
var connection = connector.get('mysql-connection');

var row = connection.fetchAssoc('SELECT * FROM my_table WHERE id = :id', {id: id});

if (row) {
response.setBody(row);
} else {
response.setStatusCode(404);
response.setBody({
message: "Entry not available"
});
}
```javascript
response.setStatusCode(200);
response.setBody({
message: "Hello World!"
});
```
6 changes: 6 additions & 0 deletions public/fusio/help/cronjob.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

## Cronjob

A cronjob provides a way to execute an action in specific time intervals.


0 comments on commit 07bffab

Please sign in to comment.