Skip to content

Commit

Permalink
Enable CORS and JSON Serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
yenilikci committed Aug 8, 2021
1 parent 0975795 commit e4fef3d
Show file tree
Hide file tree
Showing 31 changed files with 4,839 additions and 5 deletions.

Large diffs are not rendered by default.

Binary file modified angular-dotnetcore-postgresql/api/.vs/api/v16/.suo
Binary file not shown.
14 changes: 14 additions & 0 deletions angular-dotnetcore-postgresql/api/api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json.Serialization;

namespace api
{
Expand All @@ -24,12 +25,25 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
//Enable CORS
services.AddCors(c =>
{
c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
});

//JSON Serializer
services.AddControllersWithViews().AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore)
.AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());

services.AddControllers();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
//Enable CORS
app.UseCors(options => options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand Down
4 changes: 4 additions & 0 deletions angular-dotnetcore-postgresql/api/api/api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.17" />
</ItemGroup>


</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3,528 changes: 3,528 additions & 0 deletions angular-dotnetcore-postgresql/api/api/bin/Debug/netcoreapp3.1/api.deps.json

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Nusret\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Nusret\\.nuget\\packages"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "3.1.0"
},
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
64a48354853a08ab9b890f5970beac031f683c31
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
750f7c485281bc73f5bff65c62dd07b01596638f
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\appsettings.Development.json
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\appsettings.json
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\api.exe
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\api.deps.json
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\api.runtimeconfig.json
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\api.runtimeconfig.dev.json
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\api.dll
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\api.pdb
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\Microsoft.AspNetCore.JsonPatch.dll
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\Newtonsoft.Json.dll
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\bin\Debug\netcoreapp3.1\Newtonsoft.Json.Bson.dll
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.csproj.AssemblyReference.cache
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.AssemblyInfoInputs.cache
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.AssemblyInfo.cs
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.csproj.CoreCompileInputs.cache
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.MvcApplicationPartsAssemblyInfo.cache
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\staticwebassets\api.StaticWebAssets.Manifest.cache
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\staticwebassets\api.StaticWebAssets.xml
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\scopedcss\bundle\api.styles.css
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.RazorTargetAssemblyInfo.cache
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.csproj.CopyComplete
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.dll
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.pdb
C:\Users\Nusret\Desktop\fullstack-quick-webapp-dotnet-react-vue-angular\angular-dotnetcore-postgresql\api\api\obj\Debug\netcoreapp3.1\api.genruntimeconfig.cache
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b5ce5d19738e4302af3124c6a28e28319690d6be
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<StaticWebAssets Version="1.0" />
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
"frameworks": {
"netcoreapp3.1": {
"targetAlias": "netcoreapp3.1",
"dependencies": {
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": {
"target": "Package",
"version": "[3.1.17, )"
}
},
"imports": [
"net461",
"net462",
Expand Down
226 changes: 223 additions & 3 deletions angular-dotnetcore-postgresql/api/api/obj/project.assets.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,225 @@
{
"version": 3,
"targets": {
".NETCoreApp,Version=v3.1": {}
".NETCoreApp,Version=v3.1": {
"Microsoft.AspNetCore.JsonPatch/3.1.17": {
"type": "package",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "12.0.2"
},
"compile": {
"lib/netstandard2.0/Microsoft.AspNetCore.JsonPatch.dll": {}
},
"runtime": {
"lib/netstandard2.0/Microsoft.AspNetCore.JsonPatch.dll": {}
}
},
"Microsoft.AspNetCore.Mvc.NewtonsoftJson/3.1.17": {
"type": "package",
"dependencies": {
"Microsoft.AspNetCore.JsonPatch": "3.1.17",
"Newtonsoft.Json": "12.0.2",
"Newtonsoft.Json.Bson": "1.0.2"
},
"compile": {
"lib/netcoreapp3.1/Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll": {}
},
"runtime": {
"lib/netcoreapp3.1/Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll": {}
},
"frameworkReferences": [
"Microsoft.AspNetCore.App"
]
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"compile": {
"ref/netcoreapp2.0/_._": {}
},
"runtime": {
"lib/netcoreapp2.0/_._": {}
}
},
"Newtonsoft.Json/12.0.2": {
"type": "package",
"compile": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
}
},
"Newtonsoft.Json.Bson/1.0.2": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "12.0.1"
},
"compile": {
"lib/netstandard2.0/Newtonsoft.Json.Bson.dll": {}
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.Bson.dll": {}
}
}
}
},
"libraries": {
"Microsoft.AspNetCore.JsonPatch/3.1.17": {
"sha512": "oh73lAs9aM1RIRcGn6K9nCiqTWTp91QhHU9BFKa5nygkR1t2rVJZ4ktHlQcl+gi4y0RKInngK6dIfZCUoHKzxQ==",
"type": "package",
"path": "microsoft.aspnetcore.jsonpatch/3.1.17",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"THIRD-PARTY-NOTICES.TXT",
"lib/netstandard2.0/Microsoft.AspNetCore.JsonPatch.dll",
"lib/netstandard2.0/Microsoft.AspNetCore.JsonPatch.xml",
"microsoft.aspnetcore.jsonpatch.3.1.17.nupkg.sha512",
"microsoft.aspnetcore.jsonpatch.nuspec"
]
},
"Microsoft.AspNetCore.Mvc.NewtonsoftJson/3.1.17": {
"sha512": "LIu40K+DTCfTFyuTmJCXjXoPpJXIIX5WghE1exR5tv3rYtU4TSEAZ8sovC+hiapWGxRMQOdkFlwQrrKoCLvDyg==",
"type": "package",
"path": "microsoft.aspnetcore.mvc.newtonsoftjson/3.1.17",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"THIRD-PARTY-NOTICES.TXT",
"lib/netcoreapp3.1/Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll",
"lib/netcoreapp3.1/Microsoft.AspNetCore.Mvc.NewtonsoftJson.xml",
"microsoft.aspnetcore.mvc.newtonsoftjson.3.1.17.nupkg.sha512",
"microsoft.aspnetcore.mvc.newtonsoftjson.nuspec"
]
},
"Microsoft.CSharp/4.7.0": {
"sha512": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"type": "package",
"path": "microsoft.csharp/4.7.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"lib/MonoAndroid10/_._",
"lib/MonoTouch10/_._",
"lib/net45/_._",
"lib/netcore50/Microsoft.CSharp.dll",
"lib/netcoreapp2.0/_._",
"lib/netstandard1.3/Microsoft.CSharp.dll",
"lib/netstandard2.0/Microsoft.CSharp.dll",
"lib/netstandard2.0/Microsoft.CSharp.xml",
"lib/portable-net45+win8+wp8+wpa81/_._",
"lib/uap10.0.16299/_._",
"lib/win8/_._",
"lib/wp80/_._",
"lib/wpa81/_._",
"lib/xamarinios10/_._",
"lib/xamarinmac20/_._",
"lib/xamarintvos10/_._",
"lib/xamarinwatchos10/_._",
"microsoft.csharp.4.7.0.nupkg.sha512",
"microsoft.csharp.nuspec",
"ref/MonoAndroid10/_._",
"ref/MonoTouch10/_._",
"ref/net45/_._",
"ref/netcore50/Microsoft.CSharp.dll",
"ref/netcore50/Microsoft.CSharp.xml",
"ref/netcore50/de/Microsoft.CSharp.xml",
"ref/netcore50/es/Microsoft.CSharp.xml",
"ref/netcore50/fr/Microsoft.CSharp.xml",
"ref/netcore50/it/Microsoft.CSharp.xml",
"ref/netcore50/ja/Microsoft.CSharp.xml",
"ref/netcore50/ko/Microsoft.CSharp.xml",
"ref/netcore50/ru/Microsoft.CSharp.xml",
"ref/netcore50/zh-hans/Microsoft.CSharp.xml",
"ref/netcore50/zh-hant/Microsoft.CSharp.xml",
"ref/netcoreapp2.0/_._",
"ref/netstandard1.0/Microsoft.CSharp.dll",
"ref/netstandard1.0/Microsoft.CSharp.xml",
"ref/netstandard1.0/de/Microsoft.CSharp.xml",
"ref/netstandard1.0/es/Microsoft.CSharp.xml",
"ref/netstandard1.0/fr/Microsoft.CSharp.xml",
"ref/netstandard1.0/it/Microsoft.CSharp.xml",
"ref/netstandard1.0/ja/Microsoft.CSharp.xml",
"ref/netstandard1.0/ko/Microsoft.CSharp.xml",
"ref/netstandard1.0/ru/Microsoft.CSharp.xml",
"ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml",
"ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml",
"ref/netstandard2.0/Microsoft.CSharp.dll",
"ref/netstandard2.0/Microsoft.CSharp.xml",
"ref/portable-net45+win8+wp8+wpa81/_._",
"ref/uap10.0.16299/_._",
"ref/win8/_._",
"ref/wp80/_._",
"ref/wpa81/_._",
"ref/xamarinios10/_._",
"ref/xamarinmac20/_._",
"ref/xamarintvos10/_._",
"ref/xamarinwatchos10/_._",
"useSharedDesignerContext.txt",
"version.txt"
]
},
"Newtonsoft.Json/12.0.2": {
"sha512": "rTK0s2EKlfHsQsH6Yx2smvcTCeyoDNgCW7FEYyV01drPlh2T243PR2DiDXqtC5N4GDm4Ma/lkxfW5a/4793vbA==",
"type": "package",
"path": "newtonsoft.json/12.0.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.md",
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
"lib/net35/Newtonsoft.Json.dll",
"lib/net35/Newtonsoft.Json.xml",
"lib/net40/Newtonsoft.Json.dll",
"lib/net40/Newtonsoft.Json.xml",
"lib/net45/Newtonsoft.Json.dll",
"lib/net45/Newtonsoft.Json.xml",
"lib/netstandard1.0/Newtonsoft.Json.dll",
"lib/netstandard1.0/Newtonsoft.Json.xml",
"lib/netstandard1.3/Newtonsoft.Json.dll",
"lib/netstandard1.3/Newtonsoft.Json.xml",
"lib/netstandard2.0/Newtonsoft.Json.dll",
"lib/netstandard2.0/Newtonsoft.Json.xml",
"lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.dll",
"lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.xml",
"lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll",
"lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.xml",
"newtonsoft.json.12.0.2.nupkg.sha512",
"newtonsoft.json.nuspec"
]
},
"Newtonsoft.Json.Bson/1.0.2": {
"sha512": "QYFyxhaABwmq3p/21VrZNYvCg3DaEoN/wUuw5nmfAf0X3HLjgupwhkEWdgfb9nvGAUIv3osmZoD3kKl4jxEmYQ==",
"type": "package",
"path": "newtonsoft.json.bson/1.0.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.md",
"lib/net45/Newtonsoft.Json.Bson.dll",
"lib/net45/Newtonsoft.Json.Bson.pdb",
"lib/net45/Newtonsoft.Json.Bson.xml",
"lib/netstandard1.3/Newtonsoft.Json.Bson.dll",
"lib/netstandard1.3/Newtonsoft.Json.Bson.pdb",
"lib/netstandard1.3/Newtonsoft.Json.Bson.xml",
"lib/netstandard2.0/Newtonsoft.Json.Bson.dll",
"lib/netstandard2.0/Newtonsoft.Json.Bson.pdb",
"lib/netstandard2.0/Newtonsoft.Json.Bson.xml",
"newtonsoft.json.bson.1.0.2.nupkg.sha512",
"newtonsoft.json.bson.nuspec"
]
}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETCoreApp,Version=v3.1": []
".NETCoreApp,Version=v3.1": [
"Microsoft.AspNetCore.Mvc.NewtonsoftJson >= 3.1.17"
]
},
"packageFolders": {
"C:\\Users\\Nusret\\.nuget\\packages\\": {}
Expand Down Expand Up @@ -45,6 +259,12 @@
"frameworks": {
"netcoreapp3.1": {
"targetAlias": "netcoreapp3.1",
"dependencies": {
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": {
"target": "Package",
"version": "[3.1.17, )"
}
},
"imports": [
"net461",
"net462",
Expand Down
10 changes: 8 additions & 2 deletions angular-dotnetcore-postgresql/api/api/obj/project.nuget.cache
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"version": 2,
"dgSpecHash": "V+Dzju+MO/SVApfXFHv813zY+tA6wd+3BHW1x0tjdTzO7dO5M3EDlI+QPg5XvgHFQH3NxRCMGlb+OzkK0FLUVg==",
"dgSpecHash": "6g7pzv4BrKDPG0D0DCTZz0Ok2Ew7SEQARnhH0rhbgif3a2Guojldzw9et6AePhp2uElr4WLeolrgQJSoC3/thQ==",
"success": true,
"projectFilePath": "C:\\Users\\Nusret\\Desktop\\fullstack-quick-webapp-dotnet-react-vue-angular\\angular-dotnetcore-postgresql\\api\\api\\api.csproj",
"expectedPackageFiles": [],
"expectedPackageFiles": [
"C:\\Users\\Nusret\\.nuget\\packages\\microsoft.aspnetcore.jsonpatch\\3.1.17\\microsoft.aspnetcore.jsonpatch.3.1.17.nupkg.sha512",
"C:\\Users\\Nusret\\.nuget\\packages\\microsoft.aspnetcore.mvc.newtonsoftjson\\3.1.17\\microsoft.aspnetcore.mvc.newtonsoftjson.3.1.17.nupkg.sha512",
"C:\\Users\\Nusret\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512",
"C:\\Users\\Nusret\\.nuget\\packages\\newtonsoft.json\\12.0.2\\newtonsoft.json.12.0.2.nupkg.sha512",
"C:\\Users\\Nusret\\.nuget\\packages\\newtonsoft.json.bson\\1.0.2\\newtonsoft.json.bson.1.0.2.nupkg.sha512"
],
"logs": []
}

0 comments on commit e4fef3d

Please sign in to comment.