[backend] fix: Fix route handling

This commit is contained in:
ChronosX88 2019-09-25 00:23:47 +04:00
parent c9de99b9db
commit ee3071ab16
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A
2 changed files with 11 additions and 3 deletions

View File

@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using InstructorsListApp.Models;
namespace InstructorsListApp.Controllers
{
[Route("api/v1/instructors")]
[ApiController]
public class InstructorsDataController : Controller
{
DatabaseContext databaseContext;

View File

@ -27,12 +27,13 @@ namespace InstructorsListApp
.ConfigurationExtensions
.GetConnectionString(this.Configuration, "DefaultDatabase");
services.AddDbContext<DatabaseContext>(options => options.UseSqlServer(conString));
//services.
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/dist";
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -49,7 +50,14 @@ namespace InstructorsListApp
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
//app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseSpaStaticFiles();