Skip to content

Commit

Permalink
build: deploy api
Browse files Browse the repository at this point in the history
  • Loading branch information
felibatista committed Mar 13, 2024
1 parent 1639ae7 commit 8f50b66
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
12 changes: 12 additions & 0 deletions backend/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"swashbuckle.aspnetcore.cli": {
"version": "6.5.0",
"commands": [
"swagger"
]
}
}
}
11 changes: 10 additions & 1 deletion backend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(setupAction =>
{
setupAction.SwaggerDoc("v1", new OpenApiInfo
{
Title = "Shypper API",
Version = "v1"
});

setupAction.AddSecurityDefinition("ConsultaAlumnosApiBearerAuth", new OpenApiSecurityScheme() //Esto va a permitir usar swagger con el token.
{
Type = SecuritySchemeType.Http,
Expand Down Expand Up @@ -83,7 +89,10 @@
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("v1/swagger.json", "MyAPI V1");
});
}

using (var context = new UrlShortenerContext())
Expand Down
9 changes: 9 additions & 0 deletions backend/url-shortener.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@
<Folder Include="Services\" />
</ItemGroup>

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

<Target Name="OpenAPI" AfterTargets="Build" Condition="$(Configuration)=='Debug'">
<Exec Command="dotnet swagger tofile --output ./wwwroot/swagger/v1/swagger.yaml --yaml $(OutputPath)$(AssemblyName).dll v1" WorkingDirectory="$(ProjectDir)" />
<Exec Command="dotnet swagger tofile --output ./wwwroot/swagger/v1/swagger.json $(OutputPath)$(AssemblyName).dll v1" WorkingDirectory="$(ProjectDir)" />
</Target>

</Project>
Binary file modified backend/urls.sqlite
Binary file not shown.

0 comments on commit 8f50b66

Please sign in to comment.