# redirect

{% hint style="info" %}
The `redirect` method is a curried function so you don't need to send the parameters all at once
{% endhint %}

```javascript
const { response } = require('octoris')

```

## Arguments

| Name | Type   | Description                                 |
| ---- | ------ | ------------------------------------------- |
| url  | String | The url to redirect to                      |
| data | Any    | The data to pass along to the recieving url |

{% hint style="warning" %}
You must supply both arguments at some point within your handler or the function will throw an error on request
{% endhint %}

## Usage

{% hint style="info" %}
&#x20;would use the response functions within your method handlers you can read about the methods [here](https://octoris.dusty.codes/methods-api/get)
{% endhint %}

```javascript
const { response } = require('octoris')
// Since responses are curried we can create a basic status code constant
const toGoogle = response.redirect('https://google.com')

function homeHandler (ctx) {
  return toGoogle({ foo: 'bar' })
}

function aboutHandler (ctx) {
  return response.redirect('https://facebook.com', { a: 1, b: 2 })
}
```
