Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
/TheBookWizard.Services.Api/appsettings.Development.json
21 changes: 21 additions & 0 deletions TheBookWizard.Services.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// -----------------------------------------------------------------------
// Copyright (c) MumsWhoCode. All rights reserved.
// -----------------------------------------------------------------------

namespace TheBookWizard.Services.Api
{
public class Program
{
public static void Main(string[] args) =>
CreateHostBuilder(args).Build().Run();

public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
}
31 changes: 31 additions & 0 deletions TheBookWizard.Services.Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:43005",
"sslPort": 44364
}
},
"profiles": {
"TheBookWizard.Services.Api": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7195;http://localhost:5195",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
55 changes: 55 additions & 0 deletions TheBookWizard.Services.Api/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// -----------------------------------------------------------------------
// Copyright (c) MumsWhoCode. All rights reserved.
// -----------------------------------------------------------------------

using Microsoft.OpenApi.Models;

namespace TheBookWizard.Services.Api
{
public class Startup
{
public Startup(IConfiguration configuration) =>
Configuration = configuration;

public IConfiguration Configuration { get; }

public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();

services.AddSwaggerGen(options =>
{
var openApiInfo = new OpenApiInfo
{
Title = "TheBookWizard.Services.Api",
Version = "v1"
};

options.SwaggerDoc(
name: "v1",
info: openApiInfo);
});
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();

app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint(
url: "/swagger/v1/swagger.json",
name: "TheBookWizard.ServicesApi v1");
});
}

app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints => endpoints.MapControllers());
}
}
}
18 changes: 18 additions & 0 deletions TheBookWizard.Services.Api/TheBookWizard.Services.Api.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="RESTFulSense" Version="2.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
</ItemGroup>

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

</Project>
9 changes: 9 additions & 0 deletions TheBookWizard.Services.Api/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
6 changes: 6 additions & 0 deletions TheBookWizard.Services.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\..\SCMS.Services\.editorconfig = ..\..\SCMS.Services\.editorconfig
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheBookWizard.Services.Api", "TheBookWizard.Services.Api\TheBookWizard.Services.Api.csproj", "{E1FA81DF-912A-4213-9DC8-DB0BE9804DF6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -20,6 +22,10 @@ Global
{D6C6E69D-53F2-4D58-8279-19AC77BE9A87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6C6E69D-53F2-4D58-8279-19AC77BE9A87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6C6E69D-53F2-4D58-8279-19AC77BE9A87}.Release|Any CPU.Build.0 = Release|Any CPU
{E1FA81DF-912A-4213-9DC8-DB0BE9804DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1FA81DF-912A-4213-9DC8-DB0BE9804DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1FA81DF-912A-4213-9DC8-DB0BE9804DF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1FA81DF-912A-4213-9DC8-DB0BE9804DF6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down