COVID19 Lockdown Dev Log – Day 37, Postman Workflow
What I Worked On
The Taskmanager app.
What I Learned
In my work with user CRUD operations and authentication in my Taskmanager app I use the Postman tool to manage my http requests to my local server. I have used Postman rather “loosely”, but today I learned more about how to get the best out of working with Postman.
Environment variables for example. Instead of having to write “localhost:3000” followed by the URL route in all of my requests like this:
![](https://alarsen.one/blog/wp-content/uploads/2020/05/Skærmbillede-2020-05-15-kl.-19.36.13.png)
I can use an environment variable to make life easier.
![](https://alarsen.one/blog/wp-content/uploads/2020/05/Skærmbillede-2020-05-15-kl.-19.35.04.png)
It’s easy to apply. You have to create a new environment. This is done by clicking on the grindreel in the upper right corner, right next to the eye symbol:
![](https://alarsen.one/blog/wp-content/uploads/2020/05/Skærmbillede-2020-05-15-kl.-19.37.53.png)
This will present a modal menu. Click add in the bottom right corner:
![](https://alarsen.one/blog/wp-content/uploads/2020/05/Skærmbillede-2020-05-15-kl.-19.40.33.png)
Now you will be presented with a menu where you can add a name to your environment and insert your variables. I will call mine “My Test Environment” and add a variable “url” which has the value of “localhost:3000”
![](https://alarsen.one/blog/wp-content/uploads/2020/05/Skærmbillede-2020-05-15-kl.-19.42.12.png)
There we go. Now you can just type “{{url}}” and Postman will know u mean “localhost:3000”.
This is convenient if you, like me, have a collection of requests and don’t want to change the base URL in all the requests one by one. With environment variables you can do it once in one place 😀
What Distracted Me During The Day
- Messenger