Skip to content

Commit 5afed88

Browse files
Update cmdlet docs from Kestrun/Kestrun@06bda35
1 parent 1a227b0 commit 5afed88

File tree

5 files changed

+93
-17
lines changed

5 files changed

+93
-17
lines changed

docs/pwsh/tutorial/14.lifecycle/1.Start-Stop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ See also: [Endpoints](../7.endpoints/index) · [Logging](../5.logging/index)
6868
{: .fs-4 .fw-500}
6969

7070
Previous: [Server Configuration](../13.server-configuration/index)
71-
Next: [Middleware](../15.middleware/index)
71+
Next: [Full Server Demo](./2.Full-Demo)
7272

7373
[14.1-Start-Stop.ps1]: /pwsh/tutorial/examples/14.1-Start-Stop.ps1
7474
[Start-KrServer]: /pwsh/cmdlets/Start-KrServer
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Full Server Demo
3+
parent: Lifecycle
4+
nav_order: 2
5+
layout: default
6+
---
7+
8+
# Full Server Demo
9+
10+
Run an integrated demo server with multiple endpoints, basic routes, and clean start/stop.
11+
12+
## Full source
13+
14+
File: [`pwsh/tutorial/examples/14.2-Full-Demo.ps1`][14.2-Full-Demo.ps1]
15+
16+
```powershell
17+
{% include examples/pwsh/14.2-Full-Demo.ps1 %}
18+
```
19+
20+
## Step-by-step
21+
22+
1. Logging: Register a console logger.
23+
2. Certificates: Create (or reuse) a dev certificate for HTTPS.
24+
3. Server: Create a named server and add HTTP/HTTPS endpoints.
25+
4. Routes: Map a small set of demo routes (for example `/health` and `/version`).
26+
5. Lifecycle: Start non-blocking, wait for input, then stop and remove the server.
27+
28+
## Try it
29+
30+
```powershell
31+
# Run the demo (defaults to http://127.0.0.1:5000)
32+
pwsh .\docs\_includes\examples\pwsh\14.2-Full-Demo.ps1
33+
34+
# In another terminal
35+
curl -i http://127.0.0.1:5000/health
36+
curl -i http://127.0.0.1:5000/version
37+
```
38+
39+
## References
40+
41+
- [New-KrServer][New-KrServer]
42+
- [Add-KrEndpoint][Add-KrEndpoint]
43+
- [Enable-KrConfiguration][Enable-KrConfiguration]
44+
- [Start-KrServer][Start-KrServer]
45+
- [Stop-KrServer][Stop-KrServer]
46+
- [Remove-KrServer][Remove-KrServer]
47+
- [New-KrSelfSignedCertificate][New-KrSelfSignedCertificate]
48+
- [Add-KrMapRoute][Add-KrMapRoute]
49+
50+
## Troubleshooting
51+
52+
| Symptom | Cause | Fix |
53+
|---|---|---|
54+
| HTTPS endpoint fails to start | Missing/incorrect PFX password | Re-run the script and enter the correct password when prompted |
55+
| Port already in use | Another process is listening on `$Port` | Stop the other process or run the script with `-Port` set to a free port |
56+
| Script waits for input | Demo uses a “press Enter to stop” pattern | Press Enter to stop, or remove the console read line if running non-interactively |
57+
58+
---
59+
60+
### Previous / Next
61+
62+
{: .fs-4 .fw-500}
63+
64+
Previous: [Start/Stop Patterns](./1.Start-Stop)
65+
Next: [Middleware](../15.middleware/index)
66+
67+
[14.2-Full-Demo.ps1]: /pwsh/tutorial/examples/14.2-Full-Demo.ps1
68+
[New-KrServer]: /pwsh/cmdlets/New-KrServer
69+
[Add-KrEndpoint]: /pwsh/cmdlets/Add-KrEndpoint
70+
[Enable-KrConfiguration]: /pwsh/cmdlets/Enable-KrConfiguration
71+
[Start-KrServer]: /pwsh/cmdlets/Start-KrServer
72+
[Stop-KrServer]: /pwsh/cmdlets/Stop-KrServer
73+
[Remove-KrServer]: /pwsh/cmdlets/Remove-KrServer
74+
[New-KrSelfSignedCertificate]: /pwsh/cmdlets/New-KrSelfSignedCertificate
75+
[Add-KrMapRoute]: /pwsh/cmdlets/Add-KrMapRoute

docs/pwsh/tutorial/14.lifecycle/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Chapters:
1313
| # | Chapter | Focus |
1414
|---|---------|-------|
1515
| 1 | [Start/Stop Patterns](./1.Start-Stop) | Blocking vs non‑blocking, programmatic stop |
16+
| 2 | [Full Server Demo](./2.Full-Demo) | Integrated demo scenario |
1617

1718
See also: [Endpoints](../7.endpoints/index) · [Server Configuration](../13.server-configuration/index)
1819

19-
Next: [Demos](../15.demos/index)
20+
Next: [Start/Stop Patterns](./1.Start-Stop)

docs/pwsh/tutorial/examples.zip

0 Bytes
Binary file not shown.

docs/pwsh/tutorial/index.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ Static chapters and scripts are all linked directly above for quick navigation.
159159
[ch-auth-cookies]: ./8.authentication/5.Cookies
160160
[ch-auth-windows]: ./8.authentication/6.Windows-Authentication
161161
[ch-auth-claims]: ./8.authentication/7.Claims-Policies
162-
[ch-auth-multi-schemes]: ./8.authentication/8.Multiple-Schemes
163-
[ch-auth-full]: ./8.authentication/9.Full-Demo
162+
[ch-auth-multi-schemes]: ./8.authentication/10.Multiple-Schemes
163+
[ch-auth-full]: ./8.authentication/13.Full-Demo
164164
[ch-resp-text-json]: ./9.Responses/1.Basic-Text-Json
165165
[ch-resp-structured]: ./9.Responses/2.Structured-Xml-Yaml-Csv
166166
[ch-resp-binary]: ./9.Responses/3.Binary-Stream
@@ -176,7 +176,7 @@ Static chapters and scripts are all linked directly above for quick navigation.
176176
[ch-scfg-limits]: ./13.server-configuration/1.Server-Limits
177177
[ch-scfg-options]: ./13.server-configuration/2.Server-Options
178178
[ch-life-startstop]: ./14.lifecycle/1.Start-Stop
179-
[ch-demo-full]: ./17.demos/1.Full-Demo
179+
[ch-demo-full]: ./14.lifecycle/2.Full-Demo
180180
[ch-health-quick]: ./16.health/1.Health-Quickstart
181181
[ch-health-script]: ./16.health/2.Health-Script-Probe
182182
[ch-health-http]: ./16.health/3.Health-Http-Probe
@@ -193,7 +193,7 @@ Static chapters and scripts are all linked directly above for quick navigation.
193193
[ch-status-format]: /guides/statuscodepages
194194
[ch-status-redirects]: /guides/statuscodepages
195195
[ch-status-reexec]: /guides/statuscodepages
196-
[ch-mw-sessions]: ./19.Sessions/1.Sessions
196+
[ch-mw-sessions]: ./19.Sessions/1.Sessions-Basic
197197
[ch-mw-sessions-redis]: ./19.Sessions/2.Sessions-Redis
198198
[ch-mw-sessions-sql]: ./19.Sessions/3.Sessions-Sql
199199
[ch-localization]: ./21.Localization/1.Localization
@@ -230,7 +230,7 @@ Static chapters and scripts are all linked directly above for quick navigation.
230230
[sc-auth-windows]: /pwsh/tutorial/examples/8.6-Windows-Authentication.ps1
231231
[sc-auth-claims]: /pwsh/tutorial/examples/8.7-Claims-Policies.ps1
232232
[sc-auth-multi-schemes]: /pwsh/tutorial/examples/8.8-Multiple-Schemes.ps1
233-
[sc-auth-full]: /pwsh/tutorial/examples/8.9-Full-Demo.ps1
233+
[sc-auth-full]: /pwsh/tutorial/examples/8.12-Full-Demo.ps1
234234
[sc-resp-1]: /pwsh/tutorial/examples/9.1-Text-Json.ps1
235235
[sc-resp-2]: /pwsh/tutorial/examples/9.2-Structured-Xml-Yaml-Csv.ps1
236236
[sc-resp-3]: /pwsh/tutorial/examples/9.3-Binary-Stream.ps1
@@ -246,14 +246,14 @@ Static chapters and scripts are all linked directly above for quick navigation.
246246
[sc-scfg-limits]: /pwsh/tutorial/examples/13.1-Server-Limits.ps1
247247
[sc-scfg-options]: /pwsh/tutorial/examples/13.2-Server-Options.ps1
248248
[sc-life-startstop]: /pwsh/tutorial/examples/14.1-Start-Stop.ps1
249-
[sc-uploads-1]: /pwsh/tutorial/examples/22-file-and-form-uploads/22.1-Basic-Multipart.ps1
250-
[sc-uploads-2]: /pwsh/tutorial/examples/22-file-and-form-uploads/22.2-multiple-files.ps1
251-
[sc-uploads-3]: /pwsh/tutorial/examples/22-file-and-form-uploads/22.3-urlencoded.ps1
252-
[sc-uploads-4]: /pwsh/tutorial/examples/22-file-and-form-uploads/22.4-multipart-mixed.ps1
253-
[sc-uploads-5]: /pwsh/tutorial/examples/22-file-and-form-uploads/22.5-nested-multipart.ps1
254-
[sc-uploads-6]: /pwsh/tutorial/examples/22-file-and-form-uploads/22.6-request-compressed.ps1
255-
[sc-uploads-7]: /pwsh/tutorial/examples/22-file-and-form-uploads/22.7-part-compressed.ps1
256-
[sc-demo-full]: /pwsh/tutorial/examples/14.1-Full-Demo.ps1
249+
[sc-uploads-1]: /pwsh/tutorial/examples/22.1-Basic-Multipart.ps1
250+
[sc-uploads-2]: /pwsh/tutorial/examples/22.2-Multiple-Files.ps1
251+
[sc-uploads-3]: /pwsh/tutorial/examples/22.3-Url-Encoded.ps1
252+
[sc-uploads-4]: /pwsh/tutorial/examples/22.4-Multipart-Mixed.ps1
253+
[sc-uploads-5]: /pwsh/tutorial/examples/22.5-Nested-Multipart.ps1
254+
[sc-uploads-6]: /pwsh/tutorial/examples/22.6-Request-Compressed.ps1
255+
[sc-uploads-7]: /pwsh/tutorial/examples/22.7-Part-Compressed.ps1
256+
[sc-demo-full]: /pwsh/tutorial/examples/14.2-Full-Demo.ps1
257257
[sc-health-1]: /pwsh/tutorial/examples/16.1-Health-Quickstart.ps1
258258
[sc-health-2]: /pwsh/tutorial/examples/16.2-Health-Script-Probe.ps1
259259
[sc-health-3]: /pwsh/tutorial/examples/16.3-Health-Http-Probe.ps1
@@ -265,8 +265,8 @@ Static chapters and scripts are all linked directly above for quick navigation.
265265
[sc-sched-report]: /pwsh/tutorial/examples/12.3-Scheduling-Report.ps1
266266
[sc-status-1]: /pwsh/tutorial/examples/17.1-StatusCodePages-Default.ps1
267267
[sc-status-2]: /pwsh/tutorial/examples/17.2-StatusCodePages-Options.ps1
268-
[sc-status-3]: /pwsh/tutorial/examples/17.3-StatusCodePages-Handler.ps1
269-
[sc-status-4]: /pwsh/tutorial/examples/17.4-StatusCodePages-Script.ps1
268+
[sc-status-3]: /pwsh/tutorial/examples/17.3-StatusCodePages-CustomPowerShell.ps1
269+
[sc-status-4]: /pwsh/tutorial/examples/17.4-StatusCodePages-CustomCSharp.ps1
270270
[sc-status-5]: /pwsh/tutorial/examples/17.5-StatusCodePages-ContentFormat.ps1
271271
[sc-status-6]: /pwsh/tutorial/examples/17.6-StatusCodePages-Redirects.ps1
272272
[sc-status-7]: /pwsh/tutorial/examples/17.7-StatusCodePages-ReExecute.ps1

0 commit comments

Comments
 (0)