Skip to content

Commit b98e321

Browse files
committed
Initial Commit
1 parent 266bced commit b98e321

9 files changed

+209
-0
lines changed

.dockerignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

HelloWorld-Premium.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.7.34018.315
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld-Premium", "HelloWorld-Premium\HelloWorld-Premium.csproj", "{A973EA1B-D737-4B71-8160-F530C9FC143B}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A973EA1B-D737-4B71-8160-F530C9FC143B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A973EA1B-D737-4B71-8160-F530C9FC143B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A973EA1B-D737-4B71-8160-F530C9FC143B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A973EA1B-D737-4B71-8160-F530C9FC143B}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {E4B58291-2CFE-40A8-A869-2310FA71C910}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace HelloWorld_Premium.Controllers
4+
{
5+
[ApiController]
6+
[Route("api/")]
7+
public class HelloWorldController : ControllerBase
8+
{
9+
private readonly ILogger<HelloWorldController> _logger;
10+
11+
public HelloWorldController(ILogger<HelloWorldController> logger)
12+
{
13+
_logger = logger;
14+
}
15+
16+
[Route("CreateHelloWorld")]
17+
[HttpPost]
18+
public IActionResult Post()
19+
{
20+
return NoContent();
21+
}
22+
23+
[Route("GetHelloWorld")]
24+
[HttpGet]
25+
public IActionResult Get(string helloWorldId)
26+
{
27+
return NoContent();
28+
}
29+
30+
[Route("DeleteHelloWorld")]
31+
[HttpDelete]
32+
public IActionResult Delete(string helloWorldId)
33+
{
34+
return NoContent();
35+
}
36+
}
37+
}

HelloWorld-Premium/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
4+
WORKDIR /app
5+
EXPOSE 80
6+
EXPOSE 443
7+
8+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
9+
WORKDIR /src
10+
COPY ["HelloWorld-Premium/HelloWorld-Premium.csproj", "HelloWorld-Premium/"]
11+
RUN dotnet restore "HelloWorld-Premium/HelloWorld-Premium.csproj"
12+
COPY . .
13+
WORKDIR "/src/HelloWorld-Premium"
14+
RUN dotnet build "HelloWorld-Premium.csproj" -c Release -o /app/build
15+
16+
FROM build AS publish
17+
RUN dotnet publish "HelloWorld-Premium.csproj" -c Release -o /app/publish /p:UseAppHost=false
18+
19+
FROM base AS final
20+
WORKDIR /app
21+
COPY --from=publish /app/publish .
22+
ENTRYPOINT ["dotnet", "HelloWorld-Premium.dll"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<RootNamespace>HelloWorld_Premium</RootNamespace>
8+
<UserSecretsId>3df13f39-2ce4-44df-b452-d384627d2004</UserSecretsId>
9+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
14+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
15+
</ItemGroup>
16+
17+
</Project>

HelloWorld-Premium/Program.cs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
3+
// Add services to the container.
4+
5+
builder.Services.AddControllers();
6+
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
7+
builder.Services.AddEndpointsApiExplorer();
8+
builder.Services.AddSwaggerGen();
9+
10+
var app = builder.Build();
11+
12+
// Configure the HTTP request pipeline.
13+
if (app.Environment.IsDevelopment())
14+
{
15+
app.UseSwagger();
16+
app.UseSwaggerUI();
17+
}
18+
19+
app.UseHttpsRedirection();
20+
21+
app.UseAuthorization();
22+
23+
app.MapControllers();
24+
25+
app.Run();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"profiles": {
3+
"HelloWorld_Premium": {
4+
"commandName": "Project",
5+
"launchBrowser": true,
6+
"launchUrl": "swagger",
7+
"environmentVariables": {
8+
"ASPNETCORE_ENVIRONMENT": "Development"
9+
},
10+
"dotnetRunMessages": true,
11+
"applicationUrl": "https://localhost:7192;http://localhost:5155"
12+
},
13+
"IIS Express": {
14+
"commandName": "IISExpress",
15+
"launchBrowser": true,
16+
"launchUrl": "swagger",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"Docker": {
22+
"commandName": "Docker",
23+
"launchBrowser": true,
24+
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
25+
"environmentVariables": {
26+
"ASPNETCORE_URLS": "https://+:443;http://+:80"
27+
},
28+
"publishAllPorts": true,
29+
"useSSL": true
30+
}
31+
},
32+
"$schema": "https://json.schemastore.org/launchsettings.json",
33+
"iisSettings": {
34+
"windowsAuthentication": false,
35+
"anonymousAuthentication": true,
36+
"iisExpress": {
37+
"applicationUrl": "http://localhost:31607",
38+
"sslPort": 44338
39+
}
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}

HelloWorld-Premium/appsettings.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*"
9+
}

0 commit comments

Comments
 (0)