Skip to content

Commit eaab92a

Browse files
committed
updated the readme to describe the new features
1 parent b5e7aa9 commit eaab92a

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

LinkRouter/App/Configuration/Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ public void CompileRoutes()
104104
}
105105

106106
[JsonIgnore] public static Regex ErrorCodePattern = new(@"\s*\-\>\s*(\d+)\s*$", RegexOptions.Compiled | RegexOptions.CultureInvariant);
107+
107108
}

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
[⬇️How to install⬇️](#installation)
55

66
## Features
7-
- **Path-based Redirection:** Reads a config file that maps paths to redirect URLs. When a request hits a registered path, the router issues an HTTP redirect to the corresponding target.
7+
- **Path-based Redirection:** Reads a config file that maps paths to redirect URLs. When a request hits a registered path, the router issues an HTTP redirect to the corresponding target.
88
- **Hot Reloading:** The config is cached at startup and automatically reloaded when the file changes — no restart required. [Example config](#example-config)
99
- **Low Resource Usage:** Uses less than 50MB of RAM, making it ideal for constrained environments.
1010
- **Metrics Endpoint:** Exposes Prometheus-compatible metrics at `:5000/metrics` for easy observability and monitoring. [How to use](#metrics)
11-
- **Docker-Deployable:** Comes with a minimal Dockerfile for easy containerized deployment.
11+
- **Docker-Deployable:** Comes with a minimal Dockerfile for easy containerized deployment.
12+
- **Placeholders:** Supports placeholders in redirect URLs, allowing dynamic URL generation based on the requested path. For example, a route defined as `/user/{username}` can redirect to `https://example.com/profile/{username}`, where `{username}` is replaced with the actual value from the request.
13+
- **Status Code:** You are able to configure if the redirect should redirect to an url or just return a status code of your choice
1214

1315
## Configuration
1416
Routes are managed via a configuration file, `/data/config.json`. You can define paths and their corresponding URLs in this file. The application automatically normalizes routes to handle both trailing and non-trailing slashes.
@@ -24,11 +26,15 @@ Routes are managed via a configuration file, `/data/config.json`. You can define
2426
"Routes": [
2527
{
2628
"Route": "/instagram", // has to start with a slash
27-
"RedirectUrl": "https://instagram.com/{yourname}"
29+
"RedirectUrl": "https://instagram.com/maxmustermann"
2830
},
2931
{
30-
"Route": "/example", // has to start with a slash
31-
"RedirectUrl": "https://example.com"
32+
"Route": "/article/{id}", // {id} is a placeholder
33+
"RedirectUrl": "https://example.com/article/{id}", // {id} will be replaced with the actual value from the request
34+
},
35+
{
36+
"Route": "/teapot",
37+
"RedirectUrl": "-> 418" // will return a 418 status code (I'm a teapot :) )
3238
}
3339
]
3440
}

0 commit comments

Comments
 (0)