Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Porting Razor RockStars to ServiceStack V4

Tags:

servicestack

I'm currently looking at the Razor Rockstars example project on github, to try and grasp how ServiceStack V4 and Razor is glued together.

I am specifically struggling with the following piece of code in the SS Razor demo:

SetConfig(new EndpointHostConfig {
           CustomHttpHandlers = {
                { HttpStatusCode.NotFound, new RazorHandler("/notfound") },
                { HttpStatusCode.Unauthorized, new RazorHandler("/login") },
            }
        });

I know from the docs that EndpointHostConfig is now simply HostConfig, but I can't seem to locate the CustomHttpHandlers in the Service Stack V4 release notes. Is there something obvious I'm missing?

Thanks in advance.

like image 419
nover Avatar asked Dec 18 '13 16:12

nover


1 Answers

The HostConfig is limited to configuration, in v4 most of the handlers that used to be in the Config have been moved to the AppHost, e.g:

this.CustomErrorHttpHandlers[HttpStatusCode.NotFound] = new RazorHandler("/notfound");
this.CustomErrorHttpHandlers[HttpStatusCode.Unauthorized] = new RazorHandler("/login");
like image 174
mythz Avatar answered Oct 30 '22 05:10

mythz