Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dbashford committed Jul 11, 2015
1 parent f4e5a12 commit 0d9dfc4
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ new RouteBuilder()
* [path()](#path)
* [post()](#post)
* [pre()](#pre)
* [preSerial()](#preserial)
* [preParallel()](#preparallel)
* [preSerial()](#preserial)
* [put()](#put)
* [replace()](#replace)
* [validatePayload()](#validatepayload)
Expand Down Expand Up @@ -285,15 +285,6 @@ new RouteBuilder()

#### `cache`

#### `handler`
Sets the `handler` property for a Hapi route.

```javascript
new RouteBuilder().handler(function(request, reply) {
reply();
});
```

#### `delete`
Expresses a route is a DELETE.

Expand Down Expand Up @@ -326,6 +317,15 @@ new RouteBuilder()
})
```

#### `handler`
Sets the `handler` property for a Hapi route.

```javascript
new RouteBuilder().handler(function(request, reply) {
reply();
});
```

#### `method`
This function configures a Hapi route's `method` parameter. It takes a string, normally one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'. The convenience functions below are terser ways to express an HTTP method.

Expand Down Expand Up @@ -409,6 +409,32 @@ var pre = [
new RouteBuilder().pre(pre);
```

#### `preParallel`
`preParallel` works like `preSerial` except it takes multiple arrays of `preSerial` inputs. Each array represents a `pre` to execute in parallel with the other arrays of inputs.

```javascript
new RouteBuilder()
.preParallel(
["foo", fooFunc],
["bar", barFunc]
)
.preSerial("baz", bazFunc)
```

The above would execute `fooFunc` and `barFunc` in parallel, and after both are finished, execute `bazFunc`.

All the `preSerial` input variations are honored, including using an `index` integer.

```javascript
new RouteBuilder()
.preSerial("baz", bazFunc)
.preParallel(
0,
["foo", fooFunc],
["bar", barFunc]
)
```

#### `preSerial`
Hapi's `pre` configuration is an array. `preSerial` pushes a new entry to that array. `preSerial` can be called multiple times, adding more entries to the `pre` array.

Expand Down Expand Up @@ -439,32 +465,6 @@ new RouteBuilder()

Add `0` in the example above would, in this case, reverse the order of the two `preSerial`s.

#### `preParallel`
`preParallel` works like `preSerial` except it takes multiple arrays of `preSerial` inputs. Each array represents a `pre` to execute in parallel with the other arrays of inputs.

```javascript
new RouteBuilder()
.preParallel(
["foo", fooFunc],
["bar", barFunc]
)
.preSerial("baz", bazFunc)
```

The above would execute `fooFunc` and `barFunc` in parallel, and after both are finished, execute `bazFunc`.

All the `preSerial` input variations are honored, including using an `index` integer.

```javascript
new RouteBuilder()
.preSerial("baz", bazFunc)
.preParallel(
0,
["foo", fooFunc],
["bar", barFunc]
)
```

#### `put`
Expresses a route is a PUT.

Expand Down

0 comments on commit 0d9dfc4

Please sign in to comment.