Created project
This commit is contained in:
		| @@ -0,0 +1,32 @@ | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
|  | ||||
| namespace SchengenVisaApi.Controllers; | ||||
|  | ||||
| [ApiController] | ||||
| [Route("[controller]")] | ||||
| public class WeatherForecastController : ControllerBase | ||||
| { | ||||
|     private static readonly string[] Summaries = new[] | ||||
|     { | ||||
|         "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||||
|     }; | ||||
|  | ||||
|     private readonly ILogger<WeatherForecastController> _logger; | ||||
|  | ||||
|     public WeatherForecastController(ILogger<WeatherForecastController> logger) | ||||
|     { | ||||
|         _logger = logger; | ||||
|     } | ||||
|  | ||||
|     [HttpGet(Name = "GetWeatherForecast")] | ||||
|     public IEnumerable<WeatherForecast> Get() | ||||
|     { | ||||
|         return Enumerable.Range(1, 5).Select(index => new WeatherForecast | ||||
|             { | ||||
|                 Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), | ||||
|                 TemperatureC = Random.Shared.Next(-20, 55), | ||||
|                 Summary = Summaries[Random.Shared.Next(Summaries.Length)] | ||||
|             }) | ||||
|             .ToArray(); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										34
									
								
								SchengenVisaApi/SchengenVisaApi/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								SchengenVisaApi/SchengenVisaApi/Program.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| namespace SchengenVisaApi; | ||||
|  | ||||
| public class Program | ||||
| { | ||||
|     public static void Main(string[] args) | ||||
|     { | ||||
|         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,41 @@ | ||||
| { | ||||
|   "$schema": "http://json.schemastore.org/launchsettings.json", | ||||
|   "iisSettings": { | ||||
|     "windowsAuthentication": false, | ||||
|     "anonymousAuthentication": true, | ||||
|     "iisExpress": { | ||||
|       "applicationUrl": "http://localhost:8820", | ||||
|       "sslPort": 44370 | ||||
|     } | ||||
|   }, | ||||
|   "profiles": { | ||||
|     "http": { | ||||
|       "commandName": "Project", | ||||
|       "dotnetRunMessages": true, | ||||
|       "launchBrowser": true, | ||||
|       "launchUrl": "swagger", | ||||
|       "applicationUrl": "http://localhost:5022", | ||||
|       "environmentVariables": { | ||||
|         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|       } | ||||
|     }, | ||||
|     "https": { | ||||
|       "commandName": "Project", | ||||
|       "dotnetRunMessages": true, | ||||
|       "launchBrowser": true, | ||||
|       "launchUrl": "swagger", | ||||
|       "applicationUrl": "https://localhost:7168;http://localhost:5022", | ||||
|       "environmentVariables": { | ||||
|         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|       } | ||||
|     }, | ||||
|     "IIS Express": { | ||||
|       "commandName": "IISExpress", | ||||
|       "launchBrowser": true, | ||||
|       "launchUrl": "swagger", | ||||
|       "environmentVariables": { | ||||
|         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										14
									
								
								SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.csproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
|  | ||||
|     <PropertyGroup> | ||||
|         <TargetFramework>net8.0</TargetFramework> | ||||
|         <Nullable>enable</Nullable> | ||||
|         <ImplicitUsings>enable</ImplicitUsings> | ||||
|         <InvariantGlobalization>true</InvariantGlobalization> | ||||
|     </PropertyGroup> | ||||
|  | ||||
|     <ItemGroup> | ||||
|         <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/> | ||||
|     </ItemGroup> | ||||
|  | ||||
| </Project> | ||||
							
								
								
									
										6
									
								
								SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.http
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.http
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| @SchengenVisaApi_HostAddress = http://localhost:5022 | ||||
|  | ||||
| GET {{SchengenVisaApi_HostAddress}}/weatherforecast/ | ||||
| Accept: application/json | ||||
|  | ||||
| ### | ||||
							
								
								
									
										12
									
								
								SchengenVisaApi/SchengenVisaApi/WeatherForecast.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								SchengenVisaApi/SchengenVisaApi/WeatherForecast.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| namespace SchengenVisaApi; | ||||
|  | ||||
| public class WeatherForecast | ||||
| { | ||||
|     public DateOnly Date { get; set; } | ||||
|  | ||||
|     public int TemperatureC { get; set; } | ||||
|  | ||||
|     public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | ||||
|  | ||||
|     public string? Summary { get; set; } | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| { | ||||
|   "Logging": { | ||||
|     "LogLevel": { | ||||
|       "Default": "Information", | ||||
|       "Microsoft.AspNetCore": "Warning" | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										9
									
								
								SchengenVisaApi/SchengenVisaApi/appsettings.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								SchengenVisaApi/SchengenVisaApi/appsettings.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "Logging": { | ||||
|     "LogLevel": { | ||||
|       "Default": "Information", | ||||
|       "Microsoft.AspNetCore": "Warning" | ||||
|     } | ||||
|   }, | ||||
|   "AllowedHosts": "*" | ||||
| } | ||||
		Reference in New Issue
	
	Block a user