adam
fc574d5002
Some checks failed
gitea.arg.rip/_template-service/pipeline/head There was a failure building this commit
and you're getting a database, if you don't like it remove it.
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using $REPO_NAME;
|
|
using $REPO_NAME.Components;
|
|
using $REPO_NAME.Models;
|
|
|
|
var conf = greyn.Deployment.Configurator<$REPO_NAME.Configuration>.Load();
|
|
Shared.DBConnectionString = conf.DBConnectionString;
|
|
Console.WriteLine(Shared.DBConnectionString);
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
builder.Services.AddAuthorization();
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseStaticFiles();
|
|
app.UseAntiforgery();
|
|
|
|
app.MapGet("/hi", () => {
|
|
var db = new $REPO_NAMEDBContext();
|
|
var greetcount = db.Greets.FirstOrDefault();
|
|
if(greetcount == null)
|
|
{
|
|
greetcount = new GreetCounter();
|
|
db.Greets.Add(greetcount);
|
|
}
|
|
greetcount.Amount++;
|
|
db.SaveChanges();
|
|
return $"hello number {greetcount.Amount}";
|
|
}).WithName("hi").WithOpenApi();
|
|
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|