Skip to content

Commit ebb6a9e

Browse files
Gourav DwivediGourav Dwivedi
authored andcommitted
added notification music
1 parent 42bae2c commit ebb6a9e

File tree

11 files changed

+11894
-32
lines changed

11 files changed

+11894
-32
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Http;
6+
using Microsoft.AspNetCore.Mvc;
7+
8+
namespace WebApp.Controllers
9+
{
10+
[Route("api/[controller]")]
11+
[ApiController]
12+
public class TestController : ControllerBase
13+
{
14+
// GET: api/Test
15+
[HttpGet]
16+
public IEnumerable<string> Get()
17+
{
18+
return new string[] { "value1", "value2" };
19+
}
20+
21+
// GET: api/Test/5
22+
[HttpGet("{id}", Name = "Get")]
23+
public IActionResult Get(int id)
24+
{
25+
return Ok("value");
26+
}
27+
28+
// POST: api/Test
29+
[HttpPost]
30+
public IActionResult Post([FromBody] string value)
31+
{
32+
return Ok($"Deleted {value}");
33+
}
34+
35+
// PUT: api/Test/5
36+
[HttpPut("{id}")]
37+
public IActionResult Put(int id, [FromBody] string value)
38+
{
39+
return Ok($"Put {id}, {value}");
40+
}
41+
42+
// DELETE: api/ApiWithActions/5
43+
[HttpDelete("{id}")]
44+
public IActionResult Delete(int id)
45+
{
46+
return Ok($"Deleted {id}");
47+
}
48+
}
49+
}

Samples/AspDotCore/WebApp/WebApp/Startup.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
using Microsoft.Extensions.DependencyInjection;
1111
using Microsoft.IdentityModel.Tokens;
1212
using WebApp.Hubs;
13+
using Microsoft.OpenApi.Models;
14+
using System;
1315

1416
namespace WebApp
1517
{
@@ -91,6 +93,29 @@ public void ConfigureServices(IServiceCollection services)
9193
};
9294
});
9395

96+
// Register the Swagger generator, defining 1 or more Swagger documents
97+
services.AddSwaggerGen(c =>
98+
{
99+
c.SwaggerDoc("v1", new OpenApiInfo
100+
{
101+
Version = "v1",
102+
Title = "ToDo API",
103+
Description = "A simple example ASP.NET Core Web API",
104+
TermsOfService = new Uri("https://example.com/terms"),
105+
Contact = new OpenApiContact
106+
{
107+
Name = "Shayne Boyer",
108+
Email = string.Empty,
109+
Url = new Uri("https://twitter.com/spboyer"),
110+
},
111+
License = new OpenApiLicense
112+
{
113+
Name = "Use under LICX",
114+
Url = new Uri("https://example.com/license"),
115+
}
116+
});
117+
});
118+
94119
services.Configure<CookiePolicyOptions>(options =>
95120
{
96121
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
@@ -105,6 +130,16 @@ public void ConfigureServices(IServiceCollection services)
105130
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
106131
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
107132
{
133+
// Enable middleware to serve generated Swagger as a JSON endpoint.
134+
app.UseSwagger();
135+
136+
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
137+
// specifying the Swagger JSON endpoint.
138+
app.UseSwaggerUI(c =>
139+
{
140+
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
141+
});
142+
108143
app.UseCors("Cors");
109144

110145
if (env.IsDevelopment())

Samples/AspDotCore/WebApp/WebApp/WebApp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
1212
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
1313
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />
14+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
1415
</ItemGroup>
1516

1617
</Project>
349 KB
Binary file not shown.

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html> <html lang=en> <head> <meta charset=UTF-8> <meta name=viewport content="width=device-width,initial-scale=1"> <meta http-equiv=X-UA-Compatible content="ie=edge"> <title>SignalR Web Client</title> <link rel=stylesheet href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel=icon href=data:,> <link href="main.css" rel="stylesheet"></head> <body> <div class=container> <h1>SignalR Web Client</h1> <src-app></src-app> </div> <script type="text/javascript" src="main.js"></script></body> </html>
1+
<!doctype html> <html lang=en> <head> <meta charset=UTF-8> <meta name=viewport content="width=device-width,initial-scale=1"> <meta http-equiv=X-UA-Compatible content="ie=edge"> <title>SignalR Web Client</title> <link rel=stylesheet href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type=text/css> <link rel=stylesheet href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel=icon href=data:,> <link href="main.css" rel="stylesheet"></head> <body> <div class="mdl-layout mdl-layout--fixed-header"> <header class="mdl-layout__header mdl-layout__header--scroll"> <div class=mdl-layout__header-row> <span class=mdl-layout-title>SignalR Web Client</span> <button id=demo-menu-lower-right class="mdl-button mdl-js-button mdl-button--icon"> <i class=material-icons>more_vert</i> </button> <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for=demo-menu-lower-right> <li class=mdl-menu__item> <a target=_blank href=https://github.com/gourav-d/SignalR-Web-Client>Github</a> </li> </ul> </div></header> <main class=mdl-layout__content> <div class=page-content> <div class=container> <br/><br/> <src-app></src-app> </div> </div> </main> </div> <script type="text/javascript" src="main.js"></script></body> </html>

0 commit comments

Comments
 (0)