SwitchboardApplicationProxy 1.0.17

dotnet add package SwitchboardApplicationProxy --version 1.0.17                
NuGet\Install-Package SwitchboardApplicationProxy -Version 1.0.17                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SwitchboardApplicationProxy" Version="1.0.17" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SwitchboardApplicationProxy --version 1.0.17                
#r "nuget: SwitchboardApplicationProxy, 1.0.17"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SwitchboardApplicationProxy as a Cake Addin
#addin nuget:?package=SwitchboardApplicationProxy&version=1.0.17

// Install SwitchboardApplicationProxy as a Cake Tool
#tool nuget:?package=SwitchboardApplicationProxy&version=1.0.17                

<img src="https://github.com/jchristn/switchboard/blob/main/assets/icon.png?raw=true" width="140" height="128" alt="Switchboard">

Switchboard

Switchboard is a lightweight application proxy combining reverse proxy and API gateway functionality. Switchboard can be integrated directly into your app or run as a standalone server.

Help, Feedback, Contribute

If you have any issues or feedback, please file an issue here in Github. We'd love to have you help by contributing code for new features, optimization to the existing codebase, ideas for future releases, or fixes!

New in v1.0.x

  • Initial release

Default Configuration

By default, Switchboard server will listen on http://localhost:8000/ and is not configured with API endpoints or origin servers (see below for an example). If you point your browser to http://localhost:8000/ you will see a default page indicating that the node is operational. HEAD requests to this URL will also return a 200/OK.

Example (Integrated)

Refer to the Test project for a working example with one API endpoint and two origin servers.

using Switchboard.Core;

// initialize settings
SwitchboardSettings settings = new SwitchboardSettings();

// add API endpoints
settings.Endpoints.Add(new ApiEndpoint
{
    Identifier = "my-api-endpoint",
    Name = "My API endpoint",
    LoadBalancing = LoadBalancingMode.RoundRobin,
    ParameterizedUrls = new Dictionary<string, List<string>>
    {
        { "GET", new List<string> { "/my-api" } } // /my-api will be sent directly to the origin server
    },
    RewriteUrls = new Dictionary<string, Dictionary<string, string>>
    {
        {
            "GET", new Dictionary<string, string> 
            {
                "/users/{UserGuid}", "/{UserGuid}" // rewrite /users/foo to just /foo
            }
        }
    },
    OriginServers = new List<string>
    {
        "my-origin-server"
    }
});

// add origin servers
settings.Origins.Add(new OriginServer
{
    Identifier = "my-origin-server",
    Name = "My origin server",
    Hostname = "localhost",
    Port = 8001,
    Ssl = false
});

// start Switchboard
using (SwitchboardDaemon sb = new SwitchboardDaemon(settings))
{
    ...
}

Example (Standalone)

$ cd /path/to/src-directory
$ dotnet build
$ cd Switchboard.Server/bin/Debug/net8.0
$ dotnet Switchboard.Server.dll


            _ _      _    _                      _
  ____ __ _(_) |_ __| |_ | |__  ___  __ _ _ _ __| |
 (_-< V  V / |  _/ _| ' \| '_ \/ _ \/ _` | '_/ _` |
 /__/\_/\_/|_|\__\__|_||_|_.__/\___/\__,_|_| \__,_|


Switchboard Server v1.0.0

Loading from settings file ./sb.json
2024-12-05 03:30:01 INSPIRON-14 Info [SwitchboardDaemon] webserver started on http://localhost:8000
2024-12-05 03:30:01 INSPIRON-14 Info [SwitchboardDaemon] Switchboard Server started using process ID 49308

Docker

A Docker image is available in Docker Hub under jchristn/switchboard. Use the Docker Compose start (compose-up.sh and compose-up.bat) and stop (compose-down.sh and compose-down.bat) scripts in the Docker directory if you wish to run within Docker Compose. Ensure that you have a valid configuration file (e.g. sb.json) exposed into your container.

Version History

Refer to CHANGELOG.md for version history.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.17 83 12/15/2024
1.0.16 79 12/14/2024
1.0.15 72 12/13/2024
1.0.14 78 12/13/2024
1.0.12 80 12/13/2024
1.0.11 75 12/13/2024
1.0.10 77 12/13/2024
1.0.9 78 12/13/2024
1.0.7 78 12/11/2024
1.0.6 76 12/11/2024
1.0.5 78 12/10/2024
1.0.3 69 12/10/2024
1.0.2 81 12/10/2024
1.0.1 78 12/10/2024
1.0.0 85 12/5/2024

Initial release