Files
fn-serverless/examples/middleware
Travis Reeder 59188da3ae Ensure we don't break the middleware/extensions examples. (#537)
* Ensure we don't break the middleware/extensions examples.

* Fixed bug, just like this PR is meant to do. :)
2017-02-20 12:26:37 -08:00
..
2017-01-30 23:43:23 +01:00
2017-01-30 23:43:23 +01:00

Middleware Example

This example adds a simple authentication middleware to IronFunctions. See main.go for example code.

Building and Running

go build
./middleware

Then test with:

# First, create an app
fn apps create myapp
# And test
curl http://localhost:8080/v1/apps

You should get a 401 error.

Add an auth header and it should go through successfully:

curl -X GET -H "Authorization: Bearer KlaatuBaradaNikto" http://localhost:8080/v1/apps