diff --git a/app.js b/app.js index 9e8a15a..7a93bcc 100644 --- a/app.js +++ b/app.js @@ -14,7 +14,6 @@ const mainElement = document.querySelector(".main-container"); // Other let resultSkeleton = ''; let resultStorage = []; -const BACKEND_URL = "https://pizza-time-backend.vercel.app/users"; //URL Validiation function urlValidation(defaultUrl) { @@ -44,10 +43,11 @@ shortlyBtn.addEventListener("click", (e) => { } }); function fetchBackupUrl(inputValue) { - fetch(`${BACKEND_URL}?url=${encodeURIComponent(inputValue)}`) + fetch(`https://ulvis.net/API/write/get?url=${encodeURIComponent(inputValue)}`) .then((response) => response.json()) .then((response) => { if (response.data) { + console.log(response.data) let shortlyCode = response.data.url; resultSkeleton = `
${inputValue}
diff --git a/server.mjs b/server.mjs index 11560c6..28322b1 100644 --- a/server.mjs +++ b/server.mjs @@ -3,7 +3,7 @@ import cors from 'cors'; import fetch from 'node-fetch'; const app = express(); const port = 3000; -const BACKEND_URL = process.env.BACKEND_URL; + const SHORTENER_API_URL = process.env.SHORTENER_API_URL; app.use(cors()); app.use(json()); @@ -12,7 +12,7 @@ app.get('/', (req, res) => { res.send('Server Deployed 🥳'); }); -app.get(`/users`, async (req, res) => { +app.get(`/shortener`, async (req, res) => { const { url } = req.query; if (!url) { diff --git a/tsconfig.json b/tsconfig.json index d5de7d3..dcc4ff2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es6", - "module": "commonjs", + "module": "ESNext", "strict": true, "esModuleInterop": true, "skipLibCheck": true,