Git Product home page Git Product logo

shortener's Introduction

xtt28/shortener

Instantly generate shortened links online with custom aliases.

Features

  • Highly performant and optimized
  • Users can create custom aliases for links
  • Responsive user interface
  • Supports sharing via native share sheet
  • Supports HTTPS

Screenshots

Whole Page, Success Success, Zoomed In Failure

Badges

MIT License Go Report Card

Run Locally

  1. Clone the project: git clone https://github.com/xtt28/shortener
  2. Switch to the project directory: cd shortener
  3. Create your .env file (see the Environment Variables section)
  4. Start the server: go run .
  5. Go to http://localhost:8080 in your web browser

Running Tests

To run tests, run the following command:

  go test ./...

Environment Variables

To run this project, you will need to add the following environment variables to your .env file:

ROOT - the URL to your instance

PORT - the port to run your instance on

TLS

The following environment variables concern TLS:

TLS_ENABLED - whether to enable TLS

TLS_CERT - the path to the TLS certificate file

TLS_KEY - the path to the TLS key file

Please refer to the template.env file for an example.

API Reference

Create new shortened link

  POST /api/create
Parameter Type Description
destination string Required. The URL to make the short link resolve to.
alias string An alias that can be used in addition to your link's ID when sharing it.

Redirect to short link destination

  GET /v/${id}
Parameter Type Description
id string Required. The ID of the shortened link.

Tech

Client: Bootstrap, htmx

Server: Go, Gin, GORM, SQLite

Contributing

Contributions are always welcome. Please:

  1. write tests for your code;
  2. run it through go fmt and go vet.

License

MIT

shortener's People

Contributors

xtt28 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.