Skip to content

Commit

Permalink
update obsolete images (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
didicodes committed Mar 27, 2024
1 parent 5c0a385 commit 7196f1d
Show file tree
Hide file tree
Showing 26 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions docs/articles/step-1-setup-basic-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Zuplo also supports building and running your API locally. To learn more
Inside your new project, choose the `routes.oas.json` file and click **Add
Route**.

![ADd Route](https://cdn.zuplo.com/assets/8cfa5b7b-6ead-4dd0-9339-dbcdc21b6299.png)
![Add Route](../../public/media/step-1-setup-basic-gateway/image.png)

Using the Route Designer, let's configure our first route to handle the
`GET /todos` route.
Expand All @@ -34,7 +34,7 @@ Using the Route Designer, let's configure our first route to handle the
- Path: `/todos`
- [URL Forward](/docs/handlers/url-forward): `https://todos.zuplo.io`

![Get all todos](https://cdn.zuplo.com/assets/f2bcc7ad-027f-4f5e-8764-c802079dacdb.png)
![Get all todos](../../public/media/step-1-setup-basic-gateway/image-1.png)

Save your changes (you can click the disk icon next to `routes.oas.json` or
press CMD+S).
Expand All @@ -43,7 +43,7 @@ You can quickly test this route by clicking the **Test** button next to the
**Path** field. You can use the built in test tool or click the URL to open in a
new tab.

![](https://cdn.zuplo.com/assets/ef3005b5-2e69-4704-bcfe-12b2db62e0b4.png)
![Test the API](../../public/media/step-1-setup-basic-gateway/image-2.png)

You should receive a 401 Unauthorized that says something similar to

Expand All @@ -68,37 +68,37 @@ Copy the required `api-key` value from that error message to your clipboard
Open the policies section in your route and click **Add Policy** to the request
pipeline.

![Add policy](https://cdn.zuplo.com/assets/8eab7f3e-3d24-411d-8a4f-7cde11fe6ccf.png)
![Add policy](../../public/media/step-1-setup-basic-gateway/image-3.png)

Find the **Add or Set Request Header**

![Find policy](https://cdn.zuplo.com/assets/67937c50-598d-433a-945a-17787841f036.png)
![Find set requests headerpolicy](../../public/media/step-1-setup-basic-gateway/image-4.png)

Configure the policy JSON to set header name to `api-key` and the value to
`$env(API_KEY)`. This tells the policy to read the value from our secure vault
used for [Environment Variables](/docs/articles/environment-variables.md).

![Policy Configuration](https://cdn.zuplo.com/assets/e29a3c79-aeee-48e9-8c40-d1131c10f33a.png)
![Policy Configuration](../../public/media/step-1-setup-basic-gateway/image-10.png)

Save your changes to `routes.oas.json`.

Head over to the Environment Variables screen in settings and click **Add new
variable**.

![Add new Environment Variable](https://cdn.zuplo.com/assets/e9119f6a-e3e0-4d71-8739-62155e23d2da.png)
![Add new Environment Variable](../../public/media/step-1-setup-basic-gateway/image-5.png)

Set the name to `API_KEY` and select **is Secret** (the demo API key is not
really secret but if you use an API key to access your backend, that _is_ an
important secret).

![New environment variable](https://cdn.zuplo.com/assets/70fdd686-641a-4792-8a55-dafb952c0178.png)
![New environment variable](../../public/media/step-1-setup-basic-gateway/image-6.png)

## 3/ Test your API

Go back to your route in the Route Designer and click the **Test** button next
to the **Path** field. Click the **Test** button in the dialog that opens.

![](https://cdn.zuplo.com/assets/c1753ead-6bd3-4b6f-99d2-ef4c964d7b32.png)
![Test API](../../public/media/step-1-setup-basic-gateway/image-7.png)

Congratulations, your gateway is working 👏👏👏

Expand All @@ -112,12 +112,12 @@ Change the **URL Forward** value to read the base URL from the
[Environment Variables](/docs/articles/environment-variables) system by setting
the value to `${env.BASE_URL}`.

![BASE_URL from Environment](https://cdn.zuplo.com/assets/b52a04bd-b4d2-4e70-88e7-b32b1a7cba7d.png)
![BASE_URL from Environment](../../public/media/step-1-setup-basic-gateway/image-8.png)

Add another Environment Variable called BASE_URL. This is typically not a
secret, there's no need to hide this from your colleagues.

![BASE_URL Env Variable](https://cdn.zuplo.com/assets/068841d1-6554-448b-a869-62aa4076c85d.png)
![BASE_URL Env Variable](../../public/media/step-1-setup-basic-gateway/image-9.png)

Save all your changes and test your route again.

Expand Down
14 changes: 7 additions & 7 deletions docs/articles/step-2-add-api-key-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ authentication methods.
Navigate to your route in the **Route Designer** and open the **Policies**
section.

![Add policy](https://cdn.zuplo.com/assets/14b608c1-d95c-4b98-9ae8-16affad90eca.png)
![Add policy](../../public/media/step-2-add-api-key-auth/image.png)

Add the API key authentication policy and click OK to accept the default policy
JSON.

![Add API Key Authentication](https://cdn.zuplo.com/assets/811a8152-9648-4377-a070-be6ec539a4d6.png).
![Add API Key Authentication](../../public/media/step-2-add-api-key-auth/image-1.png)

:::tip

Expand All @@ -47,22 +47,22 @@ If you test your route, you should get a 401 Unauthorized response
In order to call your API, you need to configure an API consumer. Go to
Settings > API Consumers. Click **Add New Consumer**

![API Key Consumers](https://cdn.zuplo.com/assets/a716aeeb-4355-45ff-a8ed-4c20d6644424.png)
![API Key Consumers](../../public/media/step-2-add-api-key-auth/image-2.png)

Create a name for your identity - this will be the subject (or sub) that
identifies the user when calling Zuplo. Add your own e-mail address to the **Key
managers** field and add some JSON metadata - this is freeform (but must be
valid JSON). This metadata will be made available to the runtime when a key is
used to authenticate.

![New Consumer](https://cdn.zuplo.com/assets/71bee20e-eac7-4067-b1a3-50bc8267b330.png)
![New Consumer](../../public/media/step-2-add-api-key-auth/image-3.png)

## 3/ Copy Your API Key

After your API Key consumer is created, click the button to copy your new API
Key.

![New Key](https://cdn.zuplo.com/assets/aa2561ec-f6b8-4a72-8005-95dfa1ff1970.png)
![New Key](../../public/media/step-2-add-api-key-auth/image-4.png)

## 4/ Test out your new key

Expand All @@ -73,15 +73,15 @@ for this part.
Next to the path of your route in Route Designer click the **Test** button. Set
the **path** to `/todos` and hit **Test**.

![](https://cdn.zuplo.com/assets/c2db1247-eb72-474d-bfed-8b14b3b62b5e.png)
![Failed unauthorized error](../../public/media/step-2-add-api-key-auth/image-5.png)

You should get a 401 Unauthorized response. Add an new `authorization` header
with the value `Bearer YOUR_API_KEY` and insert the API Key you got from the
developer portal.

You should now get a 200 OK.

![](https://cdn.zuplo.com/assets/87c03fc4-4525-43dd-8eb7-15808b545fef.png)
![successful response](../../public/media/step-2-add-api-key-auth/image-6.png)

:::note

Expand Down
10 changes: 5 additions & 5 deletions docs/articles/step-3-add-rate-limiting.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ promise is that using Zuplo is cheaper and faster than doing this yourself.
Navigate to your route in the **Route Designer** and click **Add Policy** on the
request pipeline.

![Add policy](https://cdn.zuplo.com/assets/d2ba60f0-c8ea-4795-b219-ad26835da3d8.png)
![Add policy](../../public/media/step-3-add-rate-limiting/image.png)

Search for the rate limiting policy

![Add rate-limiting policy](https://cdn.zuplo.com/assets/97c17fe4-a11f-45c3-815a-0f6620bc995c.png)
![Add rate-limiting policy](../../public/media/step-3-add-rate-limiting/image-1.png)

Assuming you followed [step 2](./step-2-add-api-key-auth.md) and setup API Key
Authentication, set the policy to `rateLimitBy` `user` and allow 1 request every
Expand Down Expand Up @@ -57,12 +57,12 @@ This time, we will make the rate-limiting policy more dynamic, based on
properties of the customer. Update the metadata of your two API Key consumers to
have a property `customerType`. Set one to `free` and another to `premium`.

![Customer Metadata](https://cdn.zuplo.com/assets/259b5845-cbe4-47f8-986a-a9a469c30be6.png)
![Customer Metadata](../../public/media/step-3-add-rate-limiting/image-2.png)

Now add a new module to the files section by clicking on the `+` next to the
**Modules** folder and choose new empty module.

![New module](https://cdn.zuplo.com/assets/1f6b403a-67b9-43ac-8fb4-e2b813376911.png)
![New module](../../public/media/step-3-add-rate-limiting/image-3.png)

Add the following code to your module.

Expand Down Expand Up @@ -102,7 +102,7 @@ export function rateLimit(request: ZuploRequest, context: ZuploContext) {
Now we'll reconfigure the rate-limit policy to wire up our custom function. Find
the policy in the **Route Designer** and click edit.

![Edit Policy](https://cdn.zuplo.com/assets/acfa7e19-1b6c-4633-ad5c-56af4734f717.png)
![Edit Policy](../../public/media/step-3-add-rate-limiting/image-4.png)

Update the configuration

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-2-add-api-key-auth/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-2-add-api-key-auth/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-2-add-api-key-auth/image-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-2-add-api-key-auth/image-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-2-add-api-key-auth/image-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-2-add-api-key-auth/image-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-2-add-api-key-auth/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-3-add-rate-limiting/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/media/step-3-add-rate-limiting/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7196f1d

Please sign in to comment.