updated poc front end
This commit is contained in:
parent
f840331e57
commit
095628567c
@ -1,9 +1,6 @@
|
||||
# Use an official nginx image
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy the static content into the Nginx server
|
||||
COPY . /usr/share/nginx/html
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
|
@ -1,10 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello World Client</title>
|
||||
<title>Simple Frontend</title>
|
||||
<script>
|
||||
function fetchData() {
|
||||
fetch('http://localhost:8000/games')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Assuming 'data' is an array of games
|
||||
const display = document.getElementById('data-display');
|
||||
display.innerHTML = ''; // Clear previous content
|
||||
data.forEach(game => {
|
||||
const listItem = document.createElement('li');
|
||||
listItem.textContent = game.name; // Modify as per your data structure
|
||||
display.appendChild(listItem);
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
document.getElementById('data-display').textContent = 'Error loading data';
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World from Client</h1>
|
||||
<h1>Welcome to the Proof of Concept Frontend</h1>
|
||||
<button onclick="fetchData()">Fetch Data from Backend</button>
|
||||
<div id="data-display"> <!-- Data will be displayed here -->
|
||||
<!-- Fetched data will be inserted here -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -16,6 +16,8 @@ services:
|
||||
build: ./client
|
||||
ports:
|
||||
- "3000:80"
|
||||
volumes:
|
||||
- ./client:/usr/share/nginx/html
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
|
Binary file not shown.
@ -25,6 +25,19 @@ SECRET_KEY = "django-insecure-^^r9o7z%c(x51odhohd_a5k7v%1gh@2-br!g_x450+27i_2h-n
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
# SECURITY WARNING: update this when you have the production host
|
||||
CORS_ALLOW_ALL_ORIGINS = True
|
||||
|
||||
CORS_ALLOW_METHODS = [
|
||||
"DELETE",
|
||||
"GET",
|
||||
"OPTIONS",
|
||||
"PATCH",
|
||||
"POST",
|
||||
"PUT",
|
||||
]
|
||||
|
||||
|
||||
ALLOWED_HOSTS = ["0.0.0.0" ,"localhost", "127.0.0.1"]
|
||||
|
||||
|
||||
@ -39,11 +52,13 @@ INSTALLED_APPS = [
|
||||
"django.contrib.staticfiles",
|
||||
"rest_framework",
|
||||
"server",
|
||||
"corsheaders",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"corsheaders.middleware.CorsMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
|
Loading…
x
Reference in New Issue
Block a user