Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0dc7db0

Browse files
installled swagger
1 parent b56e0ed commit 0dc7db0

File tree

7 files changed

+44
-14
lines changed

7 files changed

+44
-14
lines changed

‎AngularUI/package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎AngularUI/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@angular/platform-browser": "~13.2.4",
2222
"@angular/platform-browser-dynamic": "~13.2.4",
2323
"@angular/router": "~13.2.4",
24+
"ngx-toastr": "^14.2.2",
2425
"rxjs": "~7.4.0",
2526
"tslib": "^2.3.0",
2627
"zone.js": "~0.11.4"

‎WebAPI/CompanyService/CompanyService.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
</PackageReference>
1313
</ItemGroup>
1414

15+
<ItemGroup>
16+
<ProjectReference Include="..\DataAccess\DataAccess.csproj" />
17+
</ItemGroup>
18+
1519
<ItemGroup>
1620
<Reference Include="DataAccess">
1721
<HintPath>..\DataAccess\bin\Debug\net5.0\DataAccess.dll</HintPath>

‎WebAPI/WebAPI/Properties/launchSettings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"$schema": "http://json.schemastore.org/launchsettings.json",
33
"iisSettings": {
44
"windowsAuthentication": false,
@@ -20,11 +20,11 @@
2020
"WebAPI": {
2121
"commandName": "Project",
2222
"launchBrowser": true,
23-
"launchUrl": "api/employee",
24-
"applicationUrl": "http://localhost:5000",
23+
"launchUrl": "swagger",
2524
"environmentVariables": {
2625
"ASPNETCORE_ENVIRONMENT": "Development"
27-
}
26+
},
27+
"applicationUrl": "https://localhost:5000"
2828
}
2929
}
30-
}
30+
}

‎WebAPI/WebAPI/Startup.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using CompanyService.Interfaces;
1111
using CompanyService.Services;
1212
using Microsoft.EntityFrameworkCore;
13+
using Microsoft.OpenApi.Models;
1314

1415
namespace WebAPI
1516
{
@@ -32,7 +33,7 @@ public void ConfigureServices(IServiceCollection services)
3233
//Enable CORS
3334
services.AddCors(c =>
3435
{
35-
c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin().AllowAnyMethod()
36+
c.AddPolicy("ApiCorsPolicy", options => options.AllowAnyOrigin().AllowAnyMethod()
3637
.AllowAnyHeader());
3738
});
3839

@@ -47,16 +48,22 @@ public void ConfigureServices(IServiceCollection services)
4748
services.AddControllers();
4849
services.AddTransient<IEmployeeService, EmployeeService>();
4950
services.AddTransient<IDepartmentService, DepartmentService>();
51+
services.AddSwaggerGen(c =>
52+
{
53+
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Company API", Version = "v1" });
54+
});
5055
}
5156

5257
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
5358
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5459
{
55-
app.UseCors(options => options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
5660
if (env.IsDevelopment())
5761
{
5862
app.UseDeveloperExceptionPage();
63+
app.UseSwagger();
64+
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Company API v1"));
5965
}
66+
app.UseCors("ApiCorsPolicy");
6067

6168
app.UseRouting();
6269

‎WebAPI/WebAPI/WebAPI.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@
99
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.21" />
1010
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.14" />
1111
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.14" />
12+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />
1213
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
1314
</ItemGroup>
1415

1516
<ItemGroup>
1617
<Folder Include="Photos\" />
1718
</ItemGroup>
1819

19-
<ItemGroup>
20-
<ProjectReference Include="..\CompanyService\CompanyService.csproj" />
21-
<ProjectReference Include="..\DataAccess\DataAccess.csproj" />
22-
</ItemGroup>
23-
2420
<ItemGroup>
2521
<Reference Include="CompanyService">
2622
<HintPath>refDLL\CompanyService.dll</HintPath>

‎WebAPI/WebAPI/appsettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ConnectionStrings": {
3-
//"EmployeeAppCon": "Data Source=.;Initial Catalog=WorkDb; Integrated Security=true"
4-
"EmployeeAppCon": "Data Source=IMCVBCP174-BLL\\SQLEXPRESS;Initial Catalog=WorkDb; Integrated Security=true"
3+
"EmployeeAppCon": "Data Source=.;Initial Catalog=WorkDb; Integrated Security=true"
4+
//"EmployeeAppCon": "Data Source=IMCVBCP174-BLL\\SQLEXPRESS;Initial Catalog=WorkDb; Integrated Security=true"
55
},
66
"Logging": {
77
"LogLevel": {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /