printer-api/Program.cs

27 lines
570 B
C#
Raw Normal View History

2022-02-17 15:45:42 +00:00
using Microsoft.AspNetCore.Hosting;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls("http://0.0.0.0:5000");
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<PrinterService>(new PrinterService("/dev/usb/lp0"));
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.MapControllers();
app.Run();