Skip to content

Commit

Permalink
Merge pull request #25 from subomi/subomi/docs/add-example-to-readme
Browse files Browse the repository at this point in the history
doc: added instructions to run example
  • Loading branch information
subomi authored Jun 23, 2024
2 parents 35de2a3 + 0a04212 commit 85796c7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,29 @@ Notice from the above that the migration struct name follows a particular struct

This library doesn't support multiple transformations per version as of the time of this writing. For example, no handler can have multiple changes for the same version.

## Example
Check the [example](./example) directory for a full example. Do the following to run the example:

1. Run the server.
```bash
$ git clone https://github.com/subomi/requestmigrations

$ cd example/basic

$ go run *.go
```

2. Open another terminal and call the server
```bash
# Call the API without specifying a version.
$ curl -s localhost:9000/users \
-H "Content-Type: application/json" | jq

# Call the API with 2023-04-01 version.
$ curl -s localhost:9000/users \
-H "Content-Type: application/json" \
-H "X-Example-Version: 2023-04-01" | jq
```

## License
MIT License

0 comments on commit 85796c7

Please sign in to comment.