Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jchristn/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.
https://github.com/jchristn/switchboard
api application balancer gateway load loadbalancer proxy rest reverse server
Last synced: about 2 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/jchristn/switchboard
- Owner: jchristn
- License: mit
- Created: 2024-12-03T05:53:52.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-05T03:59:18.000Z (2 months ago)
- Last Synced: 2024-12-09T12:57:37.590Z (about 2 months ago)
- Topics: api, application, balancer, gateway, load, loadbalancer, proxy, rest, reverse, server
- Language: C#
- Homepage:
- Size: 149 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 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.
```csharp
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>
{
{ "GET", new List { "/my-api" } }
},
OriginServers = new List
{
"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)
```csharp
$ 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](https://hub.docker.com/r/jchristn/switchboard) 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.