mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-16 02:22:07 -05:00
Add Startup.cs
This commit is contained in:
parent
1eeff81935
commit
087a8b16e3
56
Startup.cs
Normal file
56
Startup.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
|
||||||
|
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),
|
||||||
|
RequestPath = ""
|
||||||
|
});
|
||||||
|
|
||||||
|
app.Map("/projects", HandleRequest("projects.html"));
|
||||||
|
app.Map("/bookmarklets", HandleRequest("bookmarklets.html"));
|
||||||
|
app.Map("/settings", HandleRequest("settings.html"));
|
||||||
|
app.Map("/support", HandleRequest("support.html"));
|
||||||
|
app.Map("/about", HandleRequest("about.html"));
|
||||||
|
app.Map("/transfer", HandleRequest("transfer.html"));
|
||||||
|
app.Map("/suggest", HandleRequest("suggest.html"));
|
||||||
|
app.Map("/contact", HandleRequest("contact.html"));
|
||||||
|
app.Map("/ad", HandleRequest("ad.html"));
|
||||||
|
|
||||||
|
app.Run(async (context) =>
|
||||||
|
{
|
||||||
|
await context.Response.WriteAsync("Not Found");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Action<IApplicationBuilder> HandleRequest(string fileName)
|
||||||
|
{
|
||||||
|
return app => app.Run(async context =>
|
||||||
|
{
|
||||||
|
await context.Response.SendFileAsync(Path.Combine(Directory.GetCurrentDirectory(), fileName));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user