Skip to content

A simple redirection service for creating go / short links.

Notifications You must be signed in to change notification settings

rtholmes/redirector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c1fa4c3 · Feb 28, 2023

History

92 Commits
Feb 23, 2021
Feb 18, 2021
Feb 27, 2023
Feb 25, 2021
Feb 23, 2021
Feb 28, 2023
Feb 27, 2023
Feb 28, 2023
Feb 27, 2023
Feb 22, 2021
Feb 17, 2021
Feb 21, 2021
Feb 17, 2021
Feb 22, 2021

Repository files navigation

Redirector

This is a simple URL forwarding service configured for self hosting. It can generate random short URLs (e.g., /r32xd), named URLs (e.g., /party/june2), or a combination (e.g., /prefix/r3ce2).

The goal of the project is to be relatively simple (it is backed by .json files instead of a database), but to allow:

  • Self-registration
  • Login
  • Link creation/deletion/modification
  • An admin view for managing links

Users can only modify the links they create.

Docker

If you are using this in a dockerized environment under a prefix (say go/) the following nginx.conf rewrite rule may be useful:

location /go {
    port_in_redirect   off;
    rewrite            ^/go(/.*) $1 break;
    rewrite            ^/go$ / break;
    proxy_read_timeout 240;
    proxy_pass         http://redirector:3000;
}

Development

This project was created using create-express-typescript-app which was invoked by calling npx express-generator-typescript.

The test suites should all pass when run locally.

Pre-requisites

  • node v10.15.3+
  • yarn v1.12+
  • docker v18.01+ (if using docker image)

Available commands

  • yarn start Start a development server.
  • yarn test Run the test suite.
  • yarn cover Collect coverage data.
  • yarn build To create compiled version for prod.
  • yarn start-prod To run in production.
  • yarn stop-prod -- <id> To stop in production.

Docker local

  • run: docker run -p 3000:3000 redirector
  • stop: docker stop $(docker ps -q --filter ancestor=redirector)

About

A simple redirection service for creating go / short links.

Resources

Stars

Watchers

Forks