-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a92b24e
commit 80898d7
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
text-align: right; | ||
margin: 20px; | ||
} | ||
|
||
h1 { | ||
color: #3498db; | ||
} | ||
|
||
h2 { | ||
color: #2ecc71; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
|
||
li { | ||
margin-bottom: 10px; | ||
} | ||
</style> | ||
<title>Documentation</title> | ||
</head> | ||
<body> | ||
|
||
<div id="documentation"></div> | ||
|
||
<script> | ||
async function fetchAndDisplayDocumentation() { | ||
try { | ||
const response = await fetch('http://localhost:3000/'); | ||
const jsonData = await response.json(); | ||
|
||
createDocumentation(jsonData); | ||
} catch (error) { | ||
console.error('Error fetching JSON:', error); | ||
} | ||
} | ||
|
||
function createDocumentation(data) { | ||
const documentationDiv = document.getElementById('documentation'); | ||
|
||
const h1 = document.createElement('h1'); | ||
h1.textContent = data.name; | ||
documentationDiv.appendChild(h1); | ||
|
||
data.methods.forEach(method => { | ||
const h2 = document.createElement('h2'); | ||
h2.textContent = method.name; | ||
documentationDiv.appendChild(h2); | ||
|
||
const p = document.createElement('p'); | ||
p.textContent = "متد " + method.name + "."; | ||
documentationDiv.appendChild(p); | ||
|
||
if (method.parameters.length > 0) { | ||
const h3 = document.createElement('h3'); | ||
h3.textContent = "پارامترها"; | ||
documentationDiv.appendChild(h3); | ||
|
||
const ul = document.createElement('ul'); | ||
method.parameters.forEach(parameter => { | ||
const li = document.createElement('li'); | ||
li.textContent = parameter; | ||
ul.appendChild(li); | ||
}); | ||
documentationDiv.appendChild(ul); | ||
} | ||
}); | ||
} | ||
|
||
fetchAndDisplayDocumentation(); | ||
</script> | ||
|
||
</body> | ||
</html> |