Skip to content

Commit dd2189b

Browse files
authored
Create webhosting.html
1 parent 56918f7 commit dd2189b

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

webhosting.html

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Web Hosting | Scratch Coding Hut</title>
5+
<style>
6+
/* CSS Styles */
7+
body {
8+
font-family: Arial, sans-serif;
9+
background-color: #f4f4f9;
10+
margin: 0;
11+
padding: 0;
12+
display: flex;
13+
justify-content: center;
14+
align-items: center;
15+
height: 100vh;
16+
}
17+
18+
.container {
19+
background-color: #fff;
20+
padding: 20px;
21+
border-radius: 12px;
22+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
23+
text-align: center;
24+
width: 400px;
25+
}
26+
27+
h1 {
28+
margin-top: 0;
29+
color: #333;
30+
}
31+
32+
input {
33+
width: 80%;
34+
padding: 10px;
35+
margin-top: 10px;
36+
border: 1px solid #ccc;
37+
border-radius: 5px;
38+
}
39+
40+
button {
41+
margin-top: 15px;
42+
padding: 10px 20px;
43+
background-color: #4caf50;
44+
color: white;
45+
border: none;
46+
border-radius: 5px;
47+
cursor: pointer;
48+
}
49+
50+
button:hover {
51+
background-color: #45a049;
52+
}
53+
54+
#result {
55+
margin-top: 20px;
56+
color: #333;
57+
}
58+
</style>
59+
</head>
60+
<body>
61+
<div class="container">
62+
<h1>Web hosting</h1>
63+
<input type="text" id="repoUrl" placeholder="Enter GitHub Repo URL" />
64+
<button onclick="cloneRepo()">Clone Repo</button>
65+
<div id="result"></div>
66+
</div>
67+
68+
<script>
69+
// JavaScript for handling repo cloning
70+
async function cloneRepo() {
71+
const repoUrl = document.getElementById('repoUrl').value;
72+
const resultDiv = document.getElementById('result');
73+
74+
if (!repoUrl) {
75+
resultDiv.innerHTML = '<p style="color: red;">⚠️ Please enter a valid GitHub repository URL.</p>';
76+
return;
77+
}
78+
79+
try {
80+
const response = await fetch('/clone-repo', {
81+
method: 'POST',
82+
headers: {
83+
'Content-Type': 'application/json',
84+
},
85+
body: JSON.stringify({ repoUrl }),
86+
});
87+
88+
const data = await response.json();
89+
90+
if (response.ok) {
91+
resultDiv.innerHTML = `
92+
<p>✅ Success: ${data.message}</p>
93+
<p>📂 Folder Path: <strong>${data.folderPath}</strong></p>
94+
<p>🌐 <a href="${data.repoUrl}" target="_blank">View Your Website</a></p>
95+
`;
96+
} else {
97+
resultDiv.innerHTML = `<p style="color: red;">❌ Error: ${data.error}</p>`;
98+
}
99+
} catch (error) {
100+
console.error('Error:', error);
101+
resultDiv.innerHTML = '<p style="color: red;">⚠️ Failed to clone the repository.</p>';
102+
}
103+
}
104+
</script>
105+
</body>
106+
</html>

0 commit comments

Comments
 (0)