-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
36 lines (29 loc) · 1.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AWS API Gateway Frontend</title>
</head>
<body>
<h1>AWS API Gateway Frontend</h1>
<button onclick="callApi()">Call API</button>
<div id="apiResponse"></div>
<script>
async function callApi() {
try {
const apiUrl = 'https://p4g5smv2m4.execute-api.ap-south-1.amazonaws.com/dev/movie';
const response = await fetch(apiUrl, {
method: 'POST', // Change the HTTP method as needed (GET, POST, PUT, DELETE, etc.)
// Add headers if required, e.g., headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
});
const data = await response.json();
document.getElementById('apiResponse').innerHTML = JSON.stringify(data, null, 2);
} catch (error) {
console.error('Error calling API:', error);
}
}
</script>
</body>
</html>