# Publishing and Serving the IGP App Locally

## Steps Performed

### 1. Publish the Blazor WebAssembly App

Ran `dotnet publish` targeting Release configuration, outputting to `publish_release/`:

```
dotnet publish .\Web\Web.csproj -c Release -o .\publish_release
```

This produced a standard Blazor WASM publish layout:
- `publish_release/wwwroot/` — static assets (HTML, CSS, JS, WASM, DLLs)
- `publish_release/dotnet.js` — .NET runtime loader
- `publish_release/web.config` — IIS configuration

### 2. Serve the Published Files on Port 8777

Wrote a small Node.js static file server (`serve_publish.cjs`) that:

- Serves files from `publish_release/wwwroot/`
- Maps correct MIME types for `.wasm` ( `application/wasm` ), `.dll` ( `application/octet-stream` ), `.js` ( `application/javascript` ), `.br`, `.gz`
- Implements SPA fallback: non-file routes serve `index.html` so Blazor's client-side routing works on refresh

```
node serve_publish.cjs
```

Server is now running at **http://localhost:8777**.

### 3. Verify

- `netstat -ano | findstr ":8777"` confirms the process is LISTENING
- `curl -s -o NUL -w "%{http_code}" http://localhost:8777/` returns `200`

## How to Stop

Find the process and kill it:

```
netstat -ano | findstr ":8777.*LISTENING"
Stop-Process -Id <PID>
```

## Files

| File | Purpose |
|---|---|
| `publish_release/wwwroot/` | Published static output |
| `serve_publish.cjs` | Simple Node.js HTTP server with Blazor MIME support |
