- Everyone should be on the Postman Turing student plan
- Recommended to have Mock Server start kit docs open in a separate tab
- Quick Demo of creating Workspaces
In your capstone teams:
- Create a Workspace for your Capstone Group with Visibility set to “Public” or “Team”
- Public will allow you to share with people outside of Turing, such as employers
- Team will limit access to your team. Only use this if you are working with sensitive data (unlikely)
- Fork the Mock Server starter kit into your Workspace
- Double check that everyone on the team can see the starter kit in their workspace
Back in your capstone teams:
- Open Mock Server Starter Kit -> RESTful Endpoints -> Sample GET Request
- Hover over
{{domain}}
. You should see an errorUnresolved Variable
. Your goal is to make this error go away. - Navigate to Environments. Create a new environment, add a variable called
domain
, and give it a current value (not initial value) of "sandwich" (or any other word you desire). Save your environment. - Navigate back to the Sample GET Request. Select your newly created Environment from the Environment drop down in the top right corner of the Postman app.
- You should now see the
{{domain}}
variable resolves to the value you input in the environment variable.
Click send on the Sample GET Request. An error occurs because we don't have an actual domain yet. Bummer. We could build out the entire BE that would respond to this request, but that would take time and leave the FE blocked by the BE. Instead, we can use Example Responses to create a Mock Server. A Mock Server is like a fake BE that will respond to requests, but it can only respond with the examples you create. Notice that there is already an Example Response for the Sample GET Request.
Create Mock Server.
Add an example.
Back in your capstone teams:
- Create a Mock Server from the starter kit
- Create an example response for a POST/PUT/PATCH
3. Don't forget to add the
x-mock-match-request-body
header - Hit your Mock Server endpoints from the broswer and from Postman.
Back in your capstone teams:
- Use what you've learned to create a Mock Server for your capstone team
- Use your JSON contracts to inform what requests/examples you create
- Watch out for whitespace in your requests such as returns or spaces. They should will be denoted with icons in Postman, but they are hard to see.
- You need to click the Save button or do cmd + s on a Mac to save your work. Postman will not autosave for you.
- You need to use the browser version of Postman to collaborate with teammates
- Any variables you use in Postman must be spelled exactly correct
- When using environments, make sure that the correct environment is selected in the top right