Skip to content

Instantly share code, notes, and snippets.

@forksofpower
Last active July 8, 2023 00:34
Show Gist options
  • Save forksofpower/45c600ec8ee063e811c2b00174d79ebf to your computer and use it in GitHub Desktop.
Save forksofpower/45c600ec8ee063e811c2b00174d79ebf to your computer and use it in GitHub Desktop.
Sample `.http` File for microservice development
@baseUrl = http://localhost
@postsApi = {{baseUrl}}:4000
@commentsApi = {{baseUrl}}:4001
@queryApi = {{baseUrl}}:4002
###
# 1. create a new post
# @name post
POST {{postsApi}}/posts HTTP/1.1
Content-Type: application/json
{
"title": "Test Post {{$guid}}"
}
###
# 2. Add a comment to the post
@postId = {{post.response.body.id}}
# @prompt message
POST {{commentsApi}}/posts/{{postId}}/comments HTTP/1.1
Content-Type: application/json
{
"content": "{{message}}"
}
###
# 3. List all Posts and comments
GET {{queryApi}}/posts HTTP/1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment