Viaduct.Server
0.1.1
dotnet add package Viaduct.Server --version 0.1.1
NuGet\Install-Package Viaduct.Server -Version 0.1.1
<PackageReference Include="Viaduct.Server" Version="0.1.1" />
<PackageVersion Include="Viaduct.Server" Version="0.1.1" />
<PackageReference Include="Viaduct.Server" />
paket add Viaduct.Server --version 0.1.1
#r "nuget: Viaduct.Server, 0.1.1"
#:package Viaduct.Server@0.1.1
#addin nuget:?package=Viaduct.Server&version=0.1.1
#tool nuget:?package=Viaduct.Server&version=0.1.1
Viaduct.Server
Define your service interface once. Viaduct wires it to an ASP.NET Core server and a typed HTTP client — automatically, at compile time, with no duplication.
Viaduct.Server is the server-side package. It reads your interface at compile time and generates Minimal API endpoint handlers — no manual app.MapGet(...), no controllers, no boilerplate. The client project uses the same interface to generate a matching HTTP proxy, so both sides stay in sync automatically.
The single-source-of-truth model
┌─────────────────────────────────────────┐
│ Shared project (IUserService) │
│ Define once. Change once. Done. │
└────────────┬────────────────────────────┘
│
▼
┌─────────────────────┐
│ Your server project │ ← references Viaduct.Server
│ (this package) │
│ │
│ AddScopedAndMap │ → generates GET /users/GetUserAsync/{id}
│ <IUserService, │ generates POST /users/CreateUserAsync/...
│ UserService>() │
└─────────────────────┘
Quick start
// Program.cs
builder.Services.AddScopedAndMap<IUserService, UserService>();
// or AddTransientAndMap / AddSingletonAndMap
var app = builder.Build();
app.AddRegisteredEndpoints(); // maps all pending endpoints
app.Run();
Alternatively, register the service yourself and map endpoints separately:
builder.Services.AddScoped<IUserService, UserService>();
app.AddEndpoints<IUserService>();
Configuration
builder.Services.AddScopedAndMap<IUserService, UserService>(options =>
{
options.BasePath = "/api/v1";
options.UseInterfaceNameForPath = true; // IUserService → /UserService/...
options.RequiresAuthorization = true;
});
HTTP method inference
| Method name starts with | HTTP method |
|---|---|
Get, Find, Fetch, List, Search |
GET |
Create, Add, Insert, Post |
POST |
Update, Edit, Modify, Put |
PUT |
Delete, Remove |
DELETE |
Patch |
PATCH |
| anything else | POST |
Override with [HttpGet], [HttpPost], or [HttpMethodType("PUT")] on the method.
Which package do I need?
| Your project | Package |
|---|---|
| Defines the shared interface | Viaduct.Core |
| ASP.NET Core server | Viaduct.Server |
| Client / consumer app | Viaduct.Client |
| Needs both (integration tests, monolith) | Viaduct |
Requirements
- .NET 8, 9, or 10
- C# 14+ (uses
[InterceptsLocation]for compile-time interception) - ASP.NET Core
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Subro.Json (>= 0.0.1)
- Viaduct.Core (>= 0.1.1)
-
net8.0
- Subro.Json (>= 0.0.1)
- Viaduct.Core (>= 0.1.1)
-
net9.0
- Subro.Json (>= 0.0.1)
- Viaduct.Core (>= 0.1.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Viaduct.Server:
| Package | Downloads |
|---|---|
|
Viaduct
Meta-package that includes both Viaduct.Server and Viaduct.Client. Reference this package when your project needs both server-side endpoint mapping and client-side HTTP proxy generation (e.g. integration tests, monoliths). For most projects, reference Viaduct.Server or Viaduct.Client directly instead. |
GitHub repositories
This package is not used by any popular GitHub repositories.