Intro to Postman
Postman is a popular tool for API development. It allows you to send requests to your API and view the responses without writing any code.
Setting Up
Section titled “Setting Up”If you haven’t already, download and install Postman.
Creating a Collection
Section titled “Creating a Collection”A Collection is a group of saved requests. It helps keep your workspace organized.
- Open Postman.
- Click Collections in the sidebar.
- Click the + (Plus) icon to create a new collection.
- Name it “Task Manager API”.
Creating Requests
Section titled “Creating Requests”Let’s add a request to fetch all tasks.
- Right-click your new collection and select Add Request.
- Name the request “Get All Tasks”.
- Set the method to GET.
- Enter the URL:
http://localhost:8787/api/tasks. - Click Save.
- Click Send (make sure your Hono server is running!).
You should see the JSON response with your mock tasks in the bottom pane.
Using Environments
Section titled “Using Environments”Environments allow you to use variables. This is useful for switching between Local (localhost) and Production URLs.
Creating an Environment
Section titled “Creating an Environment”- Click Environments in the sidebar.
- Click + to create a new environment.
- Name it “Local Development”.
- Add a variable:
- Variable:
baseUrl - Initial Value:
http://localhost:8787 - Current Value:
http://localhost:8787
- Variable:
- Click Save.
Using the Variable
Section titled “Using the Variable”- Select “Local Development” from the environment dropdown at the top right.
- Go back to your request.
- Change the URL to
{{baseUrl}}/api/tasks. - Hover over
{{baseUrl}}to see it resolve to your localhost URL. - Send the request again to verify it works.
Saving Examples
Section titled “Saving Examples”Postman allows you to save the response as an example. This is great for documentation.
- After a successful request, click Save Response -> Save as Example.
In the next section, you will put all of this into practice!