Routing path with ServiceStack

2019-07-01 23:58发布

问题:

I'm using AngularJS, I want to do the following routing on ServiceStack-serving-static-html

Note the intercept any path on the screenshot.

Also note I'm not using ServiceStack for REST, I'm using it as pure webserver for serving static contents, e.g. html

Is it possible to do that on ServiceStack?

回答1:

This is node.js code, you haven't shown any C# ServiceStack AppHost code here.

ServiceStack by default supports serving of static content via HTTP, although to serve static content from the root directory of your app you should host it at /.

You've not mentioned whether you're using hosting ServiceStack via ASP.NET host or as a stand-alone self-hosting HttpListener. If it's the latter you also need to, in VS.NET set your files you want to mark the Build Action of your static files as Content and set it's Copy to Output Directory as Copy if Newer.