Skip to content

Commit 0fab7c7

Browse files
Added formatters
1 parent 12e9274 commit 0fab7c7

File tree

7 files changed

+138
-0
lines changed

7 files changed

+138
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"csharpier": {
6+
"version": "0.30.6",
7+
"commands": [
8+
"dotnet-csharpier"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
3+
// Add services to the container.
4+
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
5+
builder.Services.AddOpenApi();
6+
7+
var app = builder.Build();
8+
9+
// Configure the HTTP request pipeline.
10+
if (app.Environment.IsDevelopment())
11+
{
12+
app.MapOpenApi();
13+
}
14+
15+
app.UseHttpsRedirection();
16+
17+
var summaries = new[]
18+
{
19+
"Freezing",
20+
"Bracing",
21+
"Chilly",
22+
"Cool",
23+
"Mild",
24+
"Warm",
25+
"Balmy",
26+
"Hot",
27+
"Sweltering",
28+
"Scorching",
29+
};
30+
31+
app.MapGet(
32+
"/weatherforecast",
33+
() =>
34+
{
35+
var forecast = Enumerable
36+
.Range(1, 5)
37+
.Select(index => new WeatherForecast(
38+
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
39+
Random.Shared.Next(-20, 55),
40+
summaries[Random.Shared.Next(summaries.Length)]
41+
))
42+
.ToArray();
43+
return forecast;
44+
}
45+
)
46+
.WithName("GetWeatherForecast");
47+
48+
app.Run();
49+
50+
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
51+
{
52+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
53+
}
54+
55+
class Person
56+
{
57+
public string FirstName { get; set; } = "";
58+
public string LastName { get; set; } = "";
59+
public string DisplayName => $"{FirstName} {LastName}";
60+
61+
public void Contact()
62+
{
63+
Console.WriteLine("Contacting...");
64+
}
65+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"http": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": false,
8+
"applicationUrl": "http://localhost:5188",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development"
11+
}
12+
},
13+
"https": {
14+
"commandName": "Project",
15+
"dotnetRunMessages": true,
16+
"launchBrowser": false,
17+
"applicationUrl": "https://localhost:7067;http://localhost:5188",
18+
"environmentVariables": {
19+
"ASPNETCORE_ENVIRONMENT": "Development"
20+
}
21+
}
22+
}
23+
}
Lines changed: 8 additions & 0 deletions
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+
}
Lines changed: 9 additions & 0 deletions
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+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<RootNamespace>csharpier_example</RootNamespace>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@csharpier_example_HostAddress = http://localhost:5188
2+
3+
GET {{csharpier_example_HostAddress}}/weatherforecast/
4+
Accept: application/json
5+
6+
###

0 commit comments

Comments
 (0)