Skip to content

Commit 6851905

Browse files
committed
store urls in constants
1 parent e7b27ee commit 6851905

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { insertRedirect } from "./functions/redirects";
1111
import { redirectsRoutes } from "./routes/redirects";
1212
import bearer from "@elysiajs/bearer";
1313
import { demoRoutes } from "./routes/demo";
14+
import { NOT_FOUND_PAGE, PERSONAL_WEBSITE } from "./utils/constants";
1415

1516
const app = new Elysia()
1617
.use(cors())
@@ -48,15 +49,15 @@ const app = new Elysia()
4849
// Health check
4950
.get("/ping", () => "pong")
5051
// Homepage redirects to personal website
51-
.get("/", ({ set }) => (set.redirect = "https://axeelz.com"))
52+
.get("/", ({ set }) => (set.redirect = PERSONAL_WEBSITE))
5253
// Link redirection, where all the magic happens
5354
.get(
5455
"/:code",
5556
async ({ params, set }) => {
5657
const link = await getLink(params.code);
5758

5859
if (!link) {
59-
set.redirect = `http://dash.axlz.me/no-link?code=${params.code}`;
60+
set.redirect = `${NOT_FOUND_PAGE}?code=${params.code}`;
6061
} else {
6162
set.status = 301;
6263
set.redirect = link.url;

src/utils/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const NOT_FOUND_PAGE = "https://dash.axlz.me/no-link";
2+
3+
export const PERSONAL_WEBSITE = "https://axeelz.com";

0 commit comments

Comments
 (0)