Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

365
Views
How to add a url suffix while testing?

I am making a url shortener and trying to open the link with their unique IDs stored on my database. This is my code for it:

import { initializeApp } from "https://www.gstatic.com/firebasejs/9.9.2/firebase-app.js";
import {
    getDatabase,
    ref,
    onValue
} from "https://www.gstatic.com/firebasejs/9.9.2/firebase-database.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
const firebaseConfig = {
    apiKey: "...",
    authDomain: "...",
    projected: "...",
    storageBucket: "...",
    messagingSenderId: "...",
    appId: "...",
};
const app = initializeApp(firebaseConfig);

const db = getDatabase();
const get = ref(
    db,
    "Urls/" +
        (window.location + "").split("/")[(window.location + "").split("/").length - 1]
);
console.log(((window.location + "").split("/")[(window.location + "").split("/").length - 1]))
onValue(get, (snapshot) => {
    window.location.href = snapshot.val().actualUrl
});

Now, according to this, my URL will look like this: link.shortly.com/uniqueLinkId(while testing, it will be fileLocation/link-opener.html/uniqueLinkId ), but this does not work while testing. When I give the URL this extra value, in the end, I get this error: enter image description here

I guess this issue will be gone when I host it, but I am testing it first before hosting.

Also, I would be glad if I could know how I can add extra value in these such cases.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!