From e2917d2f2e9a2c9a2ee4cf72c29100c93ca8d733 Mon Sep 17 00:00:00 2001 From: glax Date: Wed, 24 May 2023 22:30:11 +0200 Subject: [PATCH] Changed CORS policy allow all origins Added Dockerfile to website Changed Ports --- Tranga-API/Dockerfile | 3 +-- Tranga-API/Program.cs | 2 +- Website/Dockerfile | 4 ++++ Website/apiConnector.js | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 Website/Dockerfile diff --git a/Tranga-API/Dockerfile b/Tranga-API/Dockerfile index 6a0e453..4db1394 100644 --- a/Tranga-API/Dockerfile +++ b/Tranga-API/Dockerfile @@ -1,7 +1,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base WORKDIR /app -EXPOSE 80 -EXPOSE 443 +EXPOSE 6530 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src diff --git a/Tranga-API/Program.cs b/Tranga-API/Program.cs index aafa6a0..8e0017e 100644 --- a/Tranga-API/Program.cs +++ b/Tranga-API/Program.cs @@ -36,7 +36,7 @@ builder.Services.AddCors(options => options.AddPolicy(name: corsHeader, policy => { - policy.WithOrigins("http://localhost", "http://127.0.0.1", "http://localhost:63342"); + policy.WithOrigins("*"); policy.WithMethods("GET", "POST", "DELETE"); }); }); diff --git a/Website/Dockerfile b/Website/Dockerfile new file mode 100644 index 0000000..bf498ee --- /dev/null +++ b/Website/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:1.10.1-alpine +COPY . /usr/share/nginx/html +EXPOSE 6531 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/Website/apiConnector.js b/Website/apiConnector.js index 52d2dbd..5afe749 100644 --- a/Website/apiConnector.js +++ b/Website/apiConnector.js @@ -1,4 +1,4 @@ -const apiUri = "http://localhost:5177"; +const apiUri = "http://localhost:6530"; async function GetData(uri){ let request = await fetch(uri, {