diff --git a/backend/.gitignore b/backend/.gitignore index 91401b6..cdd6d4f 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,2 +1,3 @@ obj/ +bin/ diff --git a/backend/Controllers/DispenserController.cs b/backend/Controllers/DispenserController.cs new file mode 100644 index 0000000..2bce8e7 --- /dev/null +++ b/backend/Controllers/DispenserController.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Mvc; + +namespace backend.Controllers; + +[ApiController] +public class DispenserController : ControllerBase +{ + [HttpPost("Dispense")] + public void Dispense() + { + // TODO send MQTT to arduino + Console.WriteLine("Dispensing.."); + } +} + diff --git a/backend/Program.cs b/backend/Program.cs index 3751555..9cbf71e 100644 --- a/backend/Program.cs +++ b/backend/Program.cs @@ -1,2 +1,27 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +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.UseCors(builder => builder.WithOrigins("*")); + +//app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/backend/Properties/launchSettings.json b/backend/Properties/launchSettings.json new file mode 100644 index 0000000..2cbfc9a --- /dev/null +++ b/backend/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:63404", + "sslPort": 44315 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5140", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7228;http://localhost:5140", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/backend/appsettings.Development.json b/backend/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/backend/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/backend/appsettings.json b/backend/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/backend/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/backend/backend.csproj b/backend/backend.csproj index f02677b..33ab97a 100644 --- a/backend/backend.csproj +++ b/backend/backend.csproj @@ -1,10 +1,15 @@ - + - Exe net7.0 - enable enable + enable + + + + + + diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 0000000..83e2e9b --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1,2 @@ +VITE_API_URL=http://localhost:5140 + diff --git a/frontend/.gitignore b/frontend/.gitignore index 38adffa..81c3ffb 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -26,3 +26,6 @@ coverage *.njsproj *.sln *.sw? + +.env + diff --git a/frontend/src/App.vue b/frontend/src/App.vue index e864195..983f3f6 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,85 +1,31 @@ + diff --git a/frontend/src/assets/logo.svg b/frontend/src/assets/logo.svg deleted file mode 100644 index 7565660..0000000 --- a/frontend/src/assets/logo.svg +++ /dev/null @@ -1 +0,0 @@ -