Skip to content

Commit

Permalink
Add http examples for example DB endpoints (#12)
Browse files Browse the repository at this point in the history
* Add http examples for example DB endpoints

* address PR comments
  • Loading branch information
LeavesOfFall authored Sep 11, 2024
1 parent 8281549 commit 288b9b1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions http/database_read_example.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@hostname=localhost
@port=4444
@address=http://{{hostname}}:{{port}}

### Get a document by ID.
# Returns an `ExampleDocument`, or `null` if there is no document with the given ID:
# {
# _id: u32,
# string: String,
# number: i32
# }
#
# @prompt id The ID of the document to get

GET {{address}}/read/{{id}}
19 changes: 19 additions & 0 deletions http/database_write_example.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@hostname=localhost
@port=4444
@address=http://{{hostname}}:{{port}}

### Insert or update a document (of type `ExampleDocument`).
# Returns HTTP status code only.
#
# @prompt id The ID of the document to insert or update
# @prompt string An arbitrary string to store in the document
# @prompt number An arbitrary 32-bit integer to store in the document

PUT {{address}}/write
Content-Type: application/json

{
"_id": {{id}},
"string": "{{string}}",
"number": {{number}}
}

0 comments on commit 288b9b1

Please sign in to comment.