Skip to content

Commit

Permalink
Upgrade to use EnableSpaFallback
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed May 27, 2020
1 parent b85fb4a commit bab1d10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
14 changes: 0 additions & 14 deletions MyApp.ServiceInterface/MyServices.cs
@@ -1,25 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ServiceStack;
using ServiceStack.Script;
using ServiceStack.DataAnnotations;
using MyApp.ServiceModel;

namespace MyApp.ServiceInterface
{
[Exclude(Feature.Metadata)]
[FallbackRoute("/{PathInfo*}", Matches="AcceptsHtml")]
public class FallbackForClientRoutes
{
public string PathInfo { get; set; }
}

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(Hello request)
{
return new HelloResponse { Result = $"Hello, {request.Name}!" };
Expand Down
5 changes: 4 additions & 1 deletion MyApp/Startup.cs
Expand Up @@ -47,7 +47,10 @@ public class AppHost : AppHostBase
// Configure your AppHost with the necessary configuration and dependencies your App needs
public override void Configure(Container container)
{
Plugins.Add(new SharpPagesFeature()); // enable server-side rendering, see: https://sharpscript.net/docs/sharp-pages
// enable server-side rendering, see: https://sharpscript.net/docs/sharp-pages
Plugins.Add(new SharpPagesFeature {
EnableSpaFallback = true
});

SetConfig(new HostConfig
{
Expand Down

0 comments on commit bab1d10

Please sign in to comment.