Skip to content

Commit 0da11c7

Browse files
Remove server
1 parent e11ed9d commit 0da11c7

File tree

6 files changed

+6
-33
lines changed

6 files changed

+6
-33
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
/.pnp
66
.pnp.js
77
.env
8+
.github
89
# testing
910
/coverage
10-
1111
# production
1212
/build
1313

app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ shortlyBtn.addEventListener("click", (e) => {
4343
}
4444
});
4545
function fetchBackupUrl(inputValue) {
46-
fetch(`https://ulvis.net/API/write/get?url=${encodeURIComponent(inputValue)}`)
46+
fetch(`http://localhost:3000/shortener?url=${encodeURIComponent(inputValue)}`)
4747
.then((response) => response.json())
4848
.then((response) => {
4949
if (response.data) {

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="
1212
crossorigin="anonymous" referrerpolicy="no-referrer" />
1313
<link rel="stylesheet" href="styles.css">
14-
14+
<lin></lin>
1515
<title>Frontend Mentor | Shortly URL shortening API Challenge</title>
1616
</head>
1717

inject-env.js

-26
This file was deleted.

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"node-fetch": "^3.3.2"
66
},
77
"scripts": {
8-
"inject-env": "node inject-env.js",
98
"build": "npm run inject-env && webpack --mode production",
109
"start": "live-server",
1110
"deploy": "gh-pages -d ."
@@ -24,4 +23,4 @@
2423
"node": true
2524
}
2625
}
27-
}
26+
}

server.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fetch from 'node-fetch';
44
const app = express();
55
const port = 3000;
66

7-
const SHORTENER_API_URL = process.env.SHORTENER_API_URL;
7+
88
app.use(cors());
99
app.use(json());
1010

@@ -20,7 +20,7 @@ app.get(`/shortener`, async (req, res) => {
2020
}
2121

2222
try {
23-
const response = await fetch(`${SHORTENER_API_URL}${encodeURIComponent(url)}`);
23+
const response = await fetch(`https://ulvis.net/API/write/get?url=${(url)}`);
2424
const data = await response.json();
2525

2626
if (data.success) {

0 commit comments

Comments
 (0)