Farseer
A configurable Elixir API gateway.
Getting started
Install with:
mix archive.install hex farseer
Check the installation with:
farseer version
Create a farseer.yml
file with:
farseer example
Run the example with:
farseer run --port 8000
Quickstart
Simple configuration:
farser: 1
endpoints:
test:
path: /test
methods:
- get
- post
to: "https://internalservice:3000"
login:
path: /login
methods:
- post
to: "https://loginservice"
Specifying an handler:
login:
path: /upload
methods:
- post
handler: "Farseer.Handlers.S3"
Transformations:
login:
path: /login
methods:
- post
- patch:
headers:
- Bearer: "my token" # adds an header to the request
transform:
data:
items: body.object # returns body.objects instead of body.items
headers:
delete:
- X-service-header
add:
- X-awesome-header: "value"
Error handling:
login:
path: /login
methods:
- post
to: "https://loginservice"
errors:
- 500: 401 # transform 500 in 401
- 414: # transform 414 in 401, with custom message
status: 401
message: "teapots are not welcome!"
- any: 401 # transform any error in a 401