A super simple HTTP redirect service.
This app has been designed for nodejs v20.10.0 but will likely work with nearby versions.
Install the dependencies normally with npm install
.
Run locally with npm run start
. You can also run the application in a docker container with docker compose up
.
Specify demo redirects (i.e. URLs which show a demo of a product) in the demoRedirects const. The key of each item is used in the URL to redirect to the value if the URL contains the query string "demo". For example:
const demoRedirects = {
sonicboom: "https://demo.sam.gl/sonicboom",
hermes: "https://hermes.example.com",
};
/?demo=sonicboom
redirects tohttps://demo.sam.gl/sonicboom
/?demo=hermes
redirects tohttps://hermes.example.com
The same can be done for code redirects (i.e. URLs which contain the source code of a product.) For example:
const codeRedirects = {
sonicboom: "https://github.com/sam-gl/sonicboom",
hermes: "https://github.com/sam-gl/hermes-react",
};
/?code=sonicboom
redirects tohttps://github.com/sam-gl/sonicboom
/?code=hermes
redirects tohttps://github.com/sam-gl/hermes-react
There are two types of redirect due to the restrictions of sam.gl as the links are semi-hardcoded into the theme.