Skip to content

Commit

Permalink
Upgrade to ModularStartup
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Aug 10, 2019
1 parent bb4f08f commit 74f3f70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions MyApp.ServiceInterface/MyServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public class FallbackForClientRoutes
public class MyServices : Service
{
//Return index.html for unmatched requests so routing is handled on client
public object Any(FallbackForClientRoutes request) =>
Request.GetPageResult("/");
public object Any(FallbackForClientRoutes request) => Request.GetPageResult("/");

public object Any(Hello request)
{
Expand Down
16 changes: 11 additions & 5 deletions MyApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
using ServiceStack;
using ServiceStack.Configuration;
using MyApp.ServiceInterface;
using ServiceStack.Script;
using ServiceStack.Web;
using System;
using ServiceStack.Text;
using ServiceStack.Logging;

namespace MyApp
{
public class Startup
public class Startup : ModularStartup
{
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration) => Configuration = configuration;
public Startup(IConfiguration configuration)
: base(configuration, typeof(MyServices).Assembly) {}

// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
public new void ConfigureServices(IServiceCollection services)
{
}

Expand Down Expand Up @@ -48,8 +53,9 @@ public override void Configure(Container container)

SetConfig(new HostConfig
{
UseSameSiteCookies = true,
AddRedirectParamsToQueryString = true,
DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), false)
DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), HostingEnvironment.IsDevelopment()),
});
}
}
Expand Down

0 comments on commit 74f3f70

Please sign in to comment.