0.2 Minimal Program.cs
Wire up MVC controllers and add GET /health returning
{ status: "Healthy", mqttConnected: false } (mqttConnected hardcoded
until the MQTT publisher lands). Switch launchSettings.json to port
8080 so the DoD curl works out of the box.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ When working through this file, mark increments complete by changing `[ ]` to `[
|
|||||||
- Add `.gitignore` (dotnet template), `global.json` pinning .NET 10 SDK.
|
- Add `.gitignore` (dotnet template), `global.json` pinning .NET 10 SDK.
|
||||||
- **DoD:** `dotnet build` and `dotnet test` both succeed (no tests yet, but harness runs).
|
- **DoD:** `dotnet build` and `dotnet test` both succeed (no tests yet, but harness runs).
|
||||||
|
|
||||||
### [ ] 0.2 Minimal Program.cs
|
### [x] 0.2 Minimal Program.cs
|
||||||
- Minimal hosting + controllers wired up.
|
- Minimal hosting + controllers wired up.
|
||||||
- `GET /health` returning `{ status: "Healthy", mqttConnected: false }` (mqttConnected hardcoded for now).
|
- `GET /health` returning `{ status: "Healthy", mqttConnected: false }` (mqttConnected hardcoded for now).
|
||||||
- **DoD:** `dotnet run --project src/FrameProcessor` then `curl localhost:8080/health` returns 200 with the JSON.
|
- **DoD:** `dotnet run --project src/FrameProcessor` then `curl localhost:8080/health` returns 200 with the JSON.
|
||||||
|
|||||||
11
src/FrameProcessor/Controllers/HealthController.cs
Normal file
11
src/FrameProcessor/Controllers/HealthController.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace FrameProcessor.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("health")]
|
||||||
|
public class HealthController : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Get() => Ok(new { status = "Healthy", mqttConnected = false });
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
app.MapGet("/", () => "Hello World!");
|
app.MapControllers();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"applicationUrl": "http://localhost:5165",
|
"applicationUrl": "http://localhost:8080",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"applicationUrl": "https://localhost:7016;http://localhost:5165",
|
"applicationUrl": "https://localhost:7016;http://localhost:8080",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user