first commit api local working

master
Lucas Delanier 2 years ago
parent b81e8ba225
commit 64c244affe

@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Mvc;
namespace MovieFinderAPI.Controllers
{
[ApiController]
[Route("[controller]")]
public class SuggestedMoviesController : ControllerBase
{
private static readonly int[] suggestedMovies = new[]
{
123,123
};
private readonly ILogger<SuggestedMoviesController> _logger;
public SuggestedMoviesController(ILogger<SuggestedMoviesController> logger)
{
_logger = logger;
}
[HttpGet(Name = "GetSuggestedMovies")]
public IEnumerable<SuggestedMovies> Get()
{
return Enumerable.Range(1, 100).Select(index => new SuggestedMovies
{
Id = suggestedMovies[index],
})
.ToArray();
}
}
}

@ -0,0 +1,22 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["MovieFinderAPI/MovieFinderAPI.csproj", "MovieFinderAPI/"]
RUN dotnet restore "MovieFinderAPI/MovieFinderAPI.csproj"
COPY . .
WORKDIR "/src/MovieFinderAPI"
RUN dotnet build "MovieFinderAPI.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MovieFinderAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MovieFinderAPI.dll"]

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>a7627ab4-d806-4283-b3c5-bbcacdc38b19</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
</Project>

@ -0,0 +1,25 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

@ -0,0 +1,38 @@
{
"profiles": {
"MovieFinderAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7155;http://localhost:5155"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:34400",
"sslPort": 44351
}
}
}

@ -0,0 +1,7 @@
namespace MovieFinderAPI
{
public class SuggestedMovies
{
public int Id { get; set; }
}
}

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

@ -0,0 +1,24 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseHttpsRedirection();
int[] suggestedMovies = new int[]
{
122,123,123
};
app.MapGet("/suggestedMovies", () =>
{
var Movies = Enumerable.Range(0, suggestedMovies.Count()).Select(index =>
suggestedMovies[index])
.ToArray();
return Movies;
});
app.Run();

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:7577",
"sslPort": 44310
}
},
"profiles": {
"MovieFinder_API": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "suggestedMovies",
"applicationUrl": "https://localhost:7030;http://localhost:5030",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "suggestedMovies",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

@ -1,15 +1,17 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.810.22 VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorldLib", "HelloWorldLib\HelloWorldLib.csproj", "{48BBA997-E63D-48BB-BB2A-538457425F02}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorldLib", "HelloWorldLib\HelloWorldLib.csproj", "{48BBA997-E63D-48BB-BB2A-538457425F02}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C75DF644-C41F-4A08-8B69-C8554204AC72}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C75DF644-C41F-4A08-8B69-C8554204AC72}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorldApp", "HelloWorldApp\HelloWorldApp.csproj", "{21365B7E-4A1A-4C37-B140-A9D6FC7A7E50}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorldApp", "HelloWorldApp\HelloWorldApp.csproj", "{21365B7E-4A1A-4C37-B140-A9D6FC7A7E50}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWordLib_UnitTests", "Tests\HelloWordLib_UnitTests\HelloWordLib_UnitTests.csproj", "{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWordLib_UnitTests", "Tests\HelloWordLib_UnitTests\HelloWordLib_UnitTests.csproj", "{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MovieFinder_API", "MovieFinder_API\MovieFinder_API.csproj", "{6CB38084-6B6A-4FF1-AB03-7B3AC5CFE009}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -29,14 +31,18 @@ Global
{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.Build.0 = Release|Any CPU {F9B12DFD-EF58-429F-9344-70DFC10EC6E5}.Release|Any CPU.Build.0 = Release|Any CPU
{6CB38084-6B6A-4FF1-AB03-7B3AC5CFE009}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CB38084-6B6A-4FF1-AB03-7B3AC5CFE009}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CB38084-6B6A-4FF1-AB03-7B3AC5CFE009}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CB38084-6B6A-4FF1-AB03-7B3AC5CFE009}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4D47853B-D1A3-49A5-84BA-CD2DC65FD105}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{F9B12DFD-EF58-429F-9344-70DFC10EC6E5} = {C75DF644-C41F-4A08-8B69-C8554204AC72} {F9B12DFD-EF58-429F-9344-70DFC10EC6E5} = {C75DF644-C41F-4A08-8B69-C8554204AC72}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4D47853B-D1A3-49A5-84BA-CD2DC65FD105}
EndGlobalSection
EndGlobal EndGlobal

Loading…
Cancel
Save