Skip to content

Commit 6f72e18

Browse files
committed
http
1 parent 64d163a commit 6f72e18

12 files changed

+106
-1
lines changed

CommandQuery.Samples.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandQuery.Sample.AzureFu
2525
EndProject
2626
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandQuery.Sample.AzureFunctions.Tests", "samples\CommandQuery.Sample.AzureFunctions.Tests\CommandQuery.Sample.AzureFunctions.Tests.csproj", "{2D223ADD-F2C9-4DB7-A68D-B04965AB2060}"
2727
EndProject
28+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HttpFiles", "HttpFiles", "{6F3519E3-F0E6-4DFA-86DD-86531529C512}"
29+
ProjectSection(SolutionItems) = preProject
30+
samples\HttpFiles\GetBarQuery.http = samples\HttpFiles\GetBarQuery.http
31+
samples\HttpFiles\GetQuuxQuery.http = samples\HttpFiles\GetQuuxQuery.http
32+
samples\HttpFiles\GetQuxQuery.http = samples\HttpFiles\GetQuxQuery.http
33+
samples\HttpFiles\http-client.env.json = samples\HttpFiles\http-client.env.json
34+
samples\HttpFiles\PostBarQuery.http = samples\HttpFiles\PostBarQuery.http
35+
samples\HttpFiles\PostBazCommand.http = samples\HttpFiles\PostBazCommand.http
36+
samples\HttpFiles\PostFooCommand.http = samples\HttpFiles\PostFooCommand.http
37+
samples\HttpFiles\PostQuuxQuery.http = samples\HttpFiles\PostQuuxQuery.http
38+
samples\HttpFiles\PostQuxQuery.http = samples\HttpFiles\PostQuxQuery.http
39+
EndProjectSection
40+
EndProject
2841
Global
2942
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3043
Debug|Any CPU = Debug|Any CPU

samples/HttpFiles.png

123 KB
Loading

samples/HttpFiles/GetBarQuery.http

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@Id = 1
2+
3+
GET {{QueryUrl}}/BarQuery?Id={{Id}}
4+
Content-Type: application/json

samples/HttpFiles/GetQuuxQuery.http

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@Id = 1
2+
@DateTime = 2021-07-15T22%3A12%3A41.0000000Z
3+
@DayOfWeek = Monday
4+
5+
GET {{QueryUrl}}/QuuxQuery?Id={{Id}}&Corge.DateTime={{DateTime}}&Corge.Grault.DayOfWeek={{DayOfWeek}}
6+
Content-Type: application/json

samples/HttpFiles/GetQuxQuery.http

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@Id1 = 94e4d942-0606-4fba-90df-8604ead81968
2+
@Id2 = e085c54b-44e4-4478-a28a-25ce3eaa79ce
3+
4+
GET {{QueryUrl}}/QuxQuery?Ids={{Id1}}&Ids={{Id2}}
5+
Content-Type: application/json

samples/HttpFiles/PostBarQuery.http

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
POST {{QueryUrl}}/BarQuery
3+
Content-Type: application/json
4+
5+
{
6+
"Id": 1
7+
}

samples/HttpFiles/PostBazCommand.http

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
POST {{CommandUrl}}/BazCommand
3+
Content-Type: application/json
4+
5+
{
6+
"Value": "sv-SE"
7+
}

samples/HttpFiles/PostFooCommand.http

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
POST {{CommandUrl}}/FooCommand
3+
Content-Type: application/json
4+
5+
{
6+
"Value": "sv-SE"
7+
}

samples/HttpFiles/PostQuuxQuery.http

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
POST {{QueryUrl}}/QuuxQuery
3+
Content-Type: application/json
4+
5+
{
6+
"Id": 1,
7+
"Corge": {
8+
"DateTime": "2021-07-15T22:12:41.0000000Z",
9+
"Grault": {
10+
"DayOfWeek": 1
11+
}
12+
}
13+
}

samples/HttpFiles/PostQuxQuery.http

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
POST {{QueryUrl}}/QuxQuery
3+
Content-Type: application/json
4+
5+
{
6+
"Ids": [
7+
"94e4d942-0606-4fba-90df-8604ead81968",
8+
"e085c54b-44e4-4478-a28a-25ce3eaa79ce"
9+
]
10+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"AspNetCore": {
3+
"CommandUrl": "https://commandquerysampleaspnetcore.azurewebsites.net/api/command",
4+
"QueryUrl": "https://commandquerysampleaspnetcore.azurewebsites.net/api/query"
5+
},
6+
"AWSLambda": {
7+
"CommandUrl": "https://u3rkew3obh.execute-api.eu-central-1.amazonaws.com/Prod/command",
8+
"QueryUrl": "https://u3rkew3obh.execute-api.eu-central-1.amazonaws.com/Prod/query"
9+
},
10+
"AzureFunctions": {
11+
"CommandUrl": "https://commandquerysampleazurefunctions.azurewebsites.net/api/command",
12+
"QueryUrl": "https://commandquerysampleazurefunctions.azurewebsites.net/api/query"
13+
},
14+
"GoogleCloudFunctions": {
15+
"CommandUrl": "https://europe-north1-solid-antler-215713.cloudfunctions.net/commandquery-sample-googlecloudfunctions-command/api/command",
16+
"QueryUrl": "https://europe-north1-solid-antler-215713.cloudfunctions.net/commandquery-sample-googlecloudfunctions-query/api/query"
17+
},
18+
"http://localhost:7071": {
19+
"CommandUrl": "http://localhost:7071/api/command",
20+
"QueryUrl": "http://localhost:7071/api/query"
21+
}
22+
}

samples/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,21 @@ The unit tests are using [NUnit](https://github.com/nunit/nunit).
66

77
Try out the sample projects via the Postman Workspace:
88

9-
* https://www.postman.com/hlaueriksson/workspace/commandquery/overview
9+
* <https://www.postman.com/hlaueriksson/workspace/commandquery/overview>
1010

1111
[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/30609-f711b607-24cc-4b17-955e-c24e8dbeab99?action=collection%2Ffork&collection-url=entityId%3D30609-f711b607-24cc-4b17-955e-c24e8dbeab99%26entityType%3Dcollection%26workspaceId%3D3787ce92-42c3-4e2f-9534-6ea64eb639b3)
1212

13+
Or via the `.http` files in Visual Studio:
14+
15+
* Open the `CommandQuery.Samples.sln`
16+
* Open a `.http` file in the `HttpFiles` folder
17+
* Select en environment in the HTTP Environments (F6) dropdown:
18+
* `AspNetCore` | `AWSLambda` | `AzureFunctions` | `GoogleCloudFunctions` | `http://localhost:7071`
19+
* Click the `Send request` link
20+
* [Send an HTTP request](https://learn.microsoft.com/en-us/aspnet/core/test/http-files?view=aspnetcore-8.0#send-an-http-request)
21+
22+
![Visual Studio - HttpFiles](HttpFiles.png)
23+
1324
## Command + Query + Handlers
1425

1526
Sample code:

0 commit comments

Comments
 (0)