Skip to content

Commit

Permalink
Recreated API on Visual Studio 2017 and updated SDK to fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
evgomes committed Apr 20, 2019
1 parent 4dc9810 commit 5ecc813
Show file tree
Hide file tree
Showing 58 changed files with 286 additions and 225 deletions.
22 changes: 5 additions & 17 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,18 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/bin/Debug/netcoreapp2.0/JWTAPI.dll",
"program": "${workspaceFolder}/src/JWTAPI/JWTAPI/bin/Debug/netcoreapp2.1/JWTAPI.dll",
"args": [],
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/src/JWTAPI/JWTAPI",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
"enabled": true
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/src/Views"
"/Views": "${workspaceFolder}/Views"
}
},
{
Expand All @@ -42,5 +30,5 @@
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
]
}
11 changes: 0 additions & 11 deletions .vscode/settings.json

This file was deleted.

25 changes: 23 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,30 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/JWTAPI.csproj"
"${workspaceFolder}/src/JWTAPI/JWTAPI/JWTAPI.csproj"
],
"problemMatcher": "$msCompile"
"problemMatcher": "$tsc"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/JWTAPI/JWTAPI/JWTAPI.csproj"
],
"problemMatcher": "$tsc"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/src/JWTAPI/JWTAPI/JWTAPI.csproj"
],
"problemMatcher": "$tsc"
}
]
}
22 changes: 0 additions & 22 deletions src/JWTAPI.csproj

This file was deleted.

31 changes: 31 additions & 0 deletions src/JWTAPI/JWTAPI.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.572
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JWTAPI", "JWTAPI\JWTAPI.csproj", "{9751E06C-4EB9-446E-9EA8-B3B5EC7DD7D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWTAPI.Tests", "..\..\tests\JWTAPI.Tests\JWTAPI.Tests.csproj", "{A8EF1944-2D7F-445A-8ACA-2FEAAD7D2664}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9751E06C-4EB9-446E-9EA8-B3B5EC7DD7D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9751E06C-4EB9-446E-9EA8-B3B5EC7DD7D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9751E06C-4EB9-446E-9EA8-B3B5EC7DD7D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9751E06C-4EB9-446E-9EA8-B3B5EC7DD7D8}.Release|Any CPU.Build.0 = Release|Any CPU
{A8EF1944-2D7F-445A-8ACA-2FEAAD7D2664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8EF1944-2D7F-445A-8ACA-2FEAAD7D2664}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8EF1944-2D7F-445A-8ACA-2FEAAD7D2664}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8EF1944-2D7F-445A-8ACA-2FEAAD7D2664}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {75D538DA-D647-4594-AEA5-49BC3B6899DE}
EndGlobalSection
EndGlobal
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions src/JWTAPI/JWTAPI/JWTAPI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.8" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
</ItemGroup>

</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
67 changes: 37 additions & 30 deletions src/Program.cs → src/JWTAPI/JWTAPI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
using JWTAPI.Core.Security.Hashing;
using JWTAPI.Persistence;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;

namespace JWTAPI
{
public class Program
{
public static void Main(string[] args)
{
var host = BuildWebHost(args);

using(var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var context = services.GetService<AppDbContext>();
var passwordHasher = services.GetService<IPasswordHasher>();
DatabaseSeed.Seed(context, passwordHasher);
}

host.Run();
}

public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
using JWTAPI.Core.Security.Hashing;
using JWTAPI.Persistence;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;

namespace JWTAPI
{
public class Program
{
public static void Main(string[] args)
{
var host = BuildWebHost(args);

using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var context = services.GetService<AppDbContext>();
var passwordHasher = services.GetService<IPasswordHasher>();
DatabaseSeed.Seed(context, passwordHasher);
}

host.Run();
}

public static IWebHost BuildWebHost(string[] args) =>
/*
* The call to ".UseIISIntegration" is necessary to fix issue while running the API from ISS. See the following links for reference:
* - https://github.com/aspnet/IISIntegration/issues/242
* - https://stackoverflow.com/questions/50112665/newly-created-net-core-gives-http-400-using-windows-authentication
*/

WebHost.CreateDefaultBuilder(args)
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
}
}
26 changes: 26 additions & 0 deletions src/JWTAPI/JWTAPI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5000/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchUrl": "http://localhost:5000/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"JWTAPI": {
"commandName": "IISExpress",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5ecc813

Please sign in to comment.