github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/examples/middleware/README.md (about)

     1  # Middleware Example
     2  
     3  This example adds a simple authentication middleware to IronFunctions. See [main.go](main.go) for example code. 
     4  
     5  ## Building and Running
     6  
     7  ```sh
     8  go build
     9  ./middleware
    10  ```
    11  
    12  Then test with:
    13  
    14  ```sh
    15  # First, create an app
    16  fn apps create myapp
    17  # And test
    18  curl http://localhost:8080/v1/apps
    19  ```
    20  
    21  You should get a 401 error. 
    22  
    23  Add an auth header and it should go through successfully:
    24  
    25  ```sh
    26  curl -X GET -H "Authorization: Bearer KlaatuBaradaNikto" http://localhost:8080/v1/apps
    27  ```