ShortURL is the server-side of a simple url-shortener, written in C#
10K+
ShortURL is a open source URL shortening service (a.k.a URL redirection) allowing anyone to take any existing URL and shorten it.
| Name | Type | Details |
|---|---|---|
| SqlConnection | string | The connection string of the database |
| origin | string | The origin of the web ui, usually is just the URL of the web. If you set this uncorrectly, you may meet CORS error. |
| homePage | string | The URL of the web, if one short url is missing, the user will be redirected here. |
| prefix | string | The prefix of each short url. |
Here're the config running on https://short.u2b.eu:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"SqlConnection": "server=localhost;port=3306;database=shortUrl;uid=shorturl;pwd=<pwd>;CharSet=utf8"
},
"SiteSettings": {
"origin": "https://short.u2b.eu",
"homePage": "https://short.u2b.eu",
"prefix": "https://u2b.eu"
},
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://0.0.0.0:5000"
}
}
}
}
init.sql into your Mysql/Mariadbdocker run -d -e ConnectionStrings__SqlConnection="server=<ip to the db>;port=<db port>;database=shortUrl;uid=shorturl;pwd=<pwd>;CharSet=utf8" \
-e SiteSettings__origin="https://short.u2b.eu" \
-e SiteSettings__homePage="https://short.u2b.eu" \
-e SiteSettings__prefix="https://u2b.eu" \
-p 5000:5000 \
--name url_shorter \
--restart=always \
url_shorter
init.sql into your Mysql/Mariadbappsettings.json, then run:dotnet build
dotnet run
👤 Gaojianli
Give a ⭐️ if this project helped you!
Copyright © 2020 Gaojianli.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator
Content type
Image
Digest
sha256:7e515f4e0…
Size
47.5 MB
Last updated
about 2 years ago
docker pull gaojianli2333/url_shorter