Add empty WebAPI project
This commit is contained in:
25
Diuna.sln
Normal file
25
Diuna.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.4.33110.190
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAPI", "WebAPI\WebAPI.csproj", "{EB898292-5370-45C7-85B7-FE24D110A8C6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{EB898292-5370-45C7-85B7-FE24D110A8C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{EB898292-5370-45C7-85B7-FE24D110A8C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EB898292-5370-45C7-85B7-FE24D110A8C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{EB898292-5370-45C7-85B7-FE24D110A8C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {C1F5C21F-B331-4C5D-BDFF-3FAC8116996F}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
</mat-sidenav>
|
</mat-sidenav>
|
||||||
|
|
||||||
<mat-sidenav-content>
|
<mat-sidenav-content>
|
||||||
|
<div class="" id="google-button"></div>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span>© Bim-IT Michał Zieliński {{currentDate | date: 'yyyy'}}</span>
|
<span>© Bim-IT Michał Zieliński {{currentDate | date: 'yyyy'}}</span>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { OnInit } from '@angular/core';
|
||||||
import { Component, ViewChild } from '@angular/core';
|
import { Component, ViewChild } from '@angular/core';
|
||||||
import { MatSidenav } from '@angular/material/sidenav';
|
import { MatSidenav } from '@angular/material/sidenav';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
@@ -10,7 +11,7 @@ import { DeviceService } from '../services/device.service';
|
|||||||
templateUrl: './main-view.component.html',
|
templateUrl: './main-view.component.html',
|
||||||
styleUrls: ['./main-view.component.scss']
|
styleUrls: ['./main-view.component.scss']
|
||||||
})
|
})
|
||||||
export class MainViewComponent {
|
export class MainViewComponent implements OnInit {
|
||||||
@ViewChild('snav') snav?: MatSidenav;
|
@ViewChild('snav') snav?: MatSidenav;
|
||||||
appVersion = packageInfo.version;
|
appVersion = packageInfo.version;
|
||||||
|
|
||||||
@@ -24,7 +25,31 @@ export class MainViewComponent {
|
|||||||
constructor(
|
constructor(
|
||||||
public _data: DataService,
|
public _data: DataService,
|
||||||
public _device: DeviceService
|
public _device: DeviceService
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
// @ts-ignore
|
||||||
|
google.accounts.id.initialize({
|
||||||
|
client_id: "107631825312-bkfe438ehr9k9ecb2h76g802tj6advma.apps.googleusercontent.com",
|
||||||
|
callback: this.handleCredentialResponse.bind(this),
|
||||||
|
auto_select: false,
|
||||||
|
cancel_on_tap_outside: true,
|
||||||
|
|
||||||
|
});
|
||||||
|
// @ts-ignore
|
||||||
|
google.accounts.id.renderButton(
|
||||||
|
// @ts-ignore
|
||||||
|
document.getElementById("google-button"),
|
||||||
|
{ theme: "outline", size: "large", width: "100%" }
|
||||||
|
);
|
||||||
|
// @ts-ignore
|
||||||
|
google.accounts.id.prompt((notification: PromptMomentNotification) => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
async handleCredentialResponse(response: any) {
|
||||||
|
// Here will be your response from Google.
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
|
||||||
reloadApp() {
|
reloadApp() {
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<script src="https://accounts.google.com/gsi/client" async defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="mat-typography">
|
<body class="mat-typography">
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
|
|||||||
33
WebAPI/Controllers/WeatherForecastController.cs
Normal file
33
WebAPI/Controllers/WeatherForecastController.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.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]
|
||||||
|
public IEnumerable<WeatherForecast> Get()
|
||||||
|
{
|
||||||
|
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||||
|
{
|
||||||
|
Date = DateTime.Now.AddDays(index),
|
||||||
|
TemperatureC = Random.Shared.Next(-20, 55),
|
||||||
|
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
WebAPI/Program.cs
Normal file
17
WebAPI/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// Add services to the container.
|
||||||
|
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
31
WebAPI/Properties/launchSettings.json
Normal file
31
WebAPI/Properties/launchSettings.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:1860",
|
||||||
|
"sslPort": 44315
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"WebAPI": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "weatherforecast",
|
||||||
|
"applicationUrl": "https://localhost:7170;http://localhost:5008",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "weatherforecast",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
WebAPI/WeatherForecast.cs
Normal file
13
WebAPI/WeatherForecast.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace WebAPI
|
||||||
|
{
|
||||||
|
public class WeatherForecast
|
||||||
|
{
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
public int TemperatureC { get; set; }
|
||||||
|
|
||||||
|
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||||
|
|
||||||
|
public string? Summary { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
9
WebAPI/WebAPI.csproj
Normal file
9
WebAPI/WebAPI.csproj
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
8
WebAPI/appsettings.Development.json
Normal file
8
WebAPI/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
WebAPI/appsettings.json
Normal file
9
WebAPI/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user