Permalink
Browse files

documentation for head() convenience method

  • Loading branch information...
jeremydaly committed May 16, 2018
1 parent befc95c commit b674c15ae8b84312706a9c068723353c621fc299
Showing with 2 additions and 2 deletions.
  1. +2 −2 README.md
@@ -88,7 +88,7 @@ const api = require('lambda-api')({ version: 'v1.0', base: 'v1' });

## Routes and HTTP Methods

Routes are defined by using convenience methods or the `METHOD` method. There are currently six convenience route methods: `get()`, `post()`, `put()`, `patch()`, `delete()` and `options()`. Convenience route methods require two parameters, a *route* and a function that accepts two arguments. A *route* is simply a path such as `/users`. The second parameter must be a function that accepts a `REQUEST` and a `RESPONSE` argument. These arguments can be named whatever you like, but convention dictates `req` and `res`. Examples using convenience route methods:
Routes are defined by using convenience methods or the `METHOD` method. There are currently seven convenience route methods: `get()`, `post()`, `put()`, `patch()`, `delete()`, `head()` and `options()`. Convenience route methods require two parameters, a *route* and a function that accepts two arguments. A *route* is simply a path such as `/users`. The second parameter must be a function that accepts a `REQUEST` and a `RESPONSE` argument. These arguments can be named whatever you like, but convention dictates `req` and `res`. Examples using convenience route methods:

```javascript
api.get('/users', (req,res) => {
@@ -111,7 +111,7 @@ api.METHOD('trace','/users', (req,res) => {
})
```

All `GET` methods have a `HEAD` alias that executes the `GET` request but returns a blank `body`. `GET` requests should be idempotent with no side effects.
All `GET` methods have a `HEAD` alias that executes the `GET` request but returns a blank `body`. `GET` requests should be idempotent with no side effects. The `head()` convenience method can be used to set specific paths for `HEAD` requests or to override default `GET` aliasing.

## Route Prefixing

0 comments on commit b674c15

Please sign in to comment.