Integrated the new link controller into the shortener server
This commit is contained in:
parent
eb5e070fac
commit
f1a52d3c90
@ -1,5 +1,5 @@
|
||||
import express, {Express, Request, Response} from 'express';
|
||||
import {ShortenedLink} from "../models/ShortenedLink";
|
||||
import {getLinkObjectById} from "../controller/links";
|
||||
|
||||
const app: Express = express();
|
||||
|
||||
@ -8,7 +8,7 @@ app.get("*", async (req: Request, res: Response) => {
|
||||
let redirect_url = "https://sheepstar.xyz";
|
||||
|
||||
// Search provided link
|
||||
const found = await ShortenedLink.findOne({shortenedId: link});
|
||||
const found = await getLinkObjectById(link);
|
||||
if (found != null) {
|
||||
// Update redirect url
|
||||
redirect_url = found.originalUrl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user