Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samsp/samplecleanup #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/SampleServer/Controllers/HealthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public IActionResult CheckHealth()
{
_count++;
// Simulate temporary health degradation.
return _count % 10 < 4 ? Ok() : StatusCode(500);
return ((_count % 10) < 4) ? Ok() : StatusCode(500);
}
}
}
123 changes: 0 additions & 123 deletions samples/SampleServer/Controllers/HttpController.cs

This file was deleted.

70 changes: 0 additions & 70 deletions samples/SampleServer/Controllers/UpgradeController.cs

This file was deleted.

3 changes: 1 addition & 2 deletions samples/SampleServer/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:10000;https://localhost:10001;http://localhost:10010;http://localhost:10011"
}
}
}
}
28 changes: 28 additions & 0 deletions samples/SampleServer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Sample Server

This is a simple web server implementation that can be used to test YARP proxy, by using it as the destination.

Functionality in this sample server includes:

### Echoing of Request Headers

Provided that the request URI path doesn't match other endpoints described below, then the request headers will be reported back as text in the response body. This enables you to quickly see what headers were sent, for example to analyze header transforms made by the reverse proxy.


### Healthcheck status endpoint

[HealthController](Controllers/HealthController.cs) implements an API endpoint for /api/health that will randomly return bad health status.

### WebSockets endpoint

[WebSocketsController](Controllers/WebSocketsController.cs) implements an endpoint for testing web sockets at /api/websockets.


## Usage

To run the sample server use:
- ```dotnet run``` from the sample folder
- ```dotnet run SampleServer/SampleServer.csproj``` passing in the path to the .csproj file
- Build an executable using ```dotnet build SampleServer.csproj``` and then run the executable directly

The server will listen to http://localhost:5000 and https://localhost:5001 by default. The ports and interface can be changed using the urls option on the cmd line. For example ```dotnet run SampleServer/SampleServer.csproj --urls "https://localhost:10000;http://localhost:10010"```