VSERVERWS/Program.cs
Cameron Taylor 677582d4bb Added Newtonsoft JSON.
Added input formatter for Cart saving.
Added preload for INV, Customers.
2023-05-18 15:16:14 -04:00

82 lines
1.7 KiB
C#

using CVRLIB.CVENVIRONMENT;
using static CVRLIB.CVGlobal;
using CA_ANC.Formatters;
using CVRLIB;
using CVRLIB.Inventory;
using CVRLIB.Customers;
//ZXING.dll does not copy properly to publish folder, copy manually from another lib, ie cvrlib-nf.
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
//builder.Services.AddControllers().AddJsonOptions((options => {
// //was changing PRINTER_NAME to printeR_NAME (pascal Case: https://github.com/dotnet/runtime/issues/30887)
// options.JsonSerializerOptions.PropertyNamingPolicy = null;
//}));
builder.Services
.AddControllers(options => { options.InputFormatters.Add(new ByteArrayInputFormatter()); })
.AddNewtonsoftJson()
;
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment()) {
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
VSERVERWS.Global.Globals.LoadPrinters();
CVGlobal.TryGlobalPRELoadCVCollections(new[] { typeof(CVINVENTORY), typeof(CVCustomers) });
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapControllers();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
public partial class Program {
public static CVSECRETS? CVS { get; set; } = null;
public static string AppPath { get; set; } = "";
public static string HTTPROOT { get; set; } = "";
public static bool IsDevMode { get; set; } = false;
}