I have a WebApi 2 service with front-end built in javascript/jquery and pages in pure html, i've added those front-end files to my WebApi 2 project so it will be more easier to bedug and deploy to the server.
All my js files and styles are in wwwroot while as the project is built of two "applications" the first one has html files in VMenu folder, so the next thing i've dove once i've added the html files to the project was to create static files route for em and to define the default page of VMenu folder.
But here comes the issue... i would to serve the files like routes, like i have three files in VMenu, index.html, menu.html and expired.html.
As i've set index.html as default when i write example.com/vm/ i'm able to see the index page BUT i would the same for menu.html and expired.html, like to see menu.html i would be able just to write example.com/vm/menu instead of example.com/vm/menu.html
But i wasn't able to find nothing more about that type of routing, all projects i've found were razor pages based...
Here is my Startup config:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseDefaultFiles(new DefaultFilesOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "VMenu")),
RequestPath = "/vm"
});
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "VMenu")),
RequestPath = "/vm"
});
app.UseHttpsRedirection();
app.UseRouting();
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.UseCookiePolicy();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}