Skip to content

Commit

Permalink
Remove server
Browse files Browse the repository at this point in the history
  • Loading branch information
catherineisonline committed Jul 26, 2024
1 parent e11ed9d commit 0da11c7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
/.pnp
.pnp.js
.env
.github
# testing
/coverage

# production
/build

Expand Down
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ shortlyBtn.addEventListener("click", (e) => {
}
});
function fetchBackupUrl(inputValue) {
fetch(`https://ulvis.net/API/write/get?url=${encodeURIComponent(inputValue)}`)
fetch(`http://localhost:3000/shortener?url=${encodeURIComponent(inputValue)}`)
.then((response) => response.json())
.then((response) => {
if (response.data) {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="styles.css">

<lin></lin>
<title>Frontend Mentor | Shortly URL shortening API Challenge</title>
</head>

Expand Down
26 changes: 0 additions & 26 deletions inject-env.js

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"node-fetch": "^3.3.2"
},
"scripts": {
"inject-env": "node inject-env.js",
"build": "npm run inject-env && webpack --mode production",
"start": "live-server",
"deploy": "gh-pages -d ."
Expand All @@ -24,4 +23,4 @@
"node": true
}
}
}
}
4 changes: 2 additions & 2 deletions server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fetch from 'node-fetch';
const app = express();
const port = 3000;

const SHORTENER_API_URL = process.env.SHORTENER_API_URL;

app.use(cors());
app.use(json());

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

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

if (data.success) {
Expand Down

0 comments on commit 0da11c7

Please sign in to comment.