Sign inSign up

gaojianli2333/url_shorter

By gaojianli2333

Updated about 2 years ago

ShortURL is the server-side of a simple url-shortener, written in C#

Image
Content management system
0

10K+

gaojianli2333/url_shorter repository overview

Welcome to UrlShorter 👋

Version License: MIT FOSSA: Scan

ShortURL is a open source URL shortening service (a.k.a URL redirection) allowing anyone to take any existing URL and shorten it.

✨ Demo: https://short.u2b.eu
Webui: https://github.com/Gaojianli/UrlShorter-web

Config

NameTypeDetails
SqlConnectionstringThe connection string of the database
originstringThe origin of the web ui, usually is just the URL of the web. If you set this uncorrectly, you may meet CORS error.
homePagestringThe URL of the web, if one short url is missing, the user will be redirected here.
prefixstringThe 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"
      }
    }
  }
}

Install

Docker(Recommended)
  1. Import the init.sql into your Mysql/Mariadb
  2. Run the container
docker 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
Manually
  1. Import the init.sql into your Mysql/Mariadb
  2. Edit your database config in appsettings.json, then run:
dotnet build

Usage

dotnet run

Author

👤 Gaojianli

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2020 Gaojianli.
This project is MIT licensed.

FOSSA Status


This README was generated with ❤️ by readme-md-generator

Tag summary

Content type

Image

Digest

sha256:7e515f4e0

Size

47.5 MB

Last updated

about 2 years ago

docker pull gaojianli2333/url_shorter