github.com/googlecloudplatform/kubernetes-workshops@v0.0.0-20180501174420-d8199445b2c3/bundles/kubernetes-101/workshop/app/README.md (about)

     1  # App
     2  
     3  A sample 12 Facter Application.
     4  
     5  ## Usage
     6  
     7  Generate TLS certificates:
     8  
     9  ```
    10  $ go run certgen/main.go
    11  ```
    12  ```
    13  wrote ca.pem
    14  wrote ca-key.pem
    15  wrote server.pem
    16  wrote server-key.pem
    17  ```
    18  
    19  ### Build and Run
    20  
    21  ```
    22  $ go build -o server ./monolith
    23  ```
    24  
    25  ```
    26  $ ./server
    27  ```
    28  
    29  ```
    30  2016/04/15 06:34:12 Starting server...
    31  2016/04/15 06:34:12 HTTP service listening on 0.0.0.0:5000
    32  2016/04/15 06:34:12 Health service listening on 0.0.0.0:5001
    33  2016/04/15 06:34:12 Started successfully.
    34  ```
    35  
    36  ### Test with cURL
    37  
    38  ```
    39  $ curl --cacert ./ca.pem -u user https://127.0.0.1:5000/login
    40  ```
    41  ```
    42  Enter host password for user 'user':
    43  eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20iLCJleHAiOjE0NjA5ODcxOTcsImlhdCI6MTQ2MDcyNzk5NywiaXNzIjoiYXV0aC5zZXJ2aWNlIiwic3ViIjoidXNlciJ9.x3oFhRhWk5CGYfGcrNctPGWCENEsXpUuKPDQU2ZOLCY
    44  ```
    45  
    46  > type "password" at the prompt
    47  
    48  ```
    49  curl --cacert ./ca.pem -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20iLCJleHAiOjE0NjA5ODcxOTcsImlhdCI6MTQ2MDcyNzk5NywiaXNzIjoiYXV0aC5zZXJ2aWNlIiwic3ViIjoidXNlciJ9.x3oFhRhWk5CGYfGcrNctPGWCENEsXpUuKPDQU2ZOLCY' https://127.0.0.1:5000/
    50  ```
    51  ```
    52  <h1>Hello</h1>
    53  ```