Last active
May 7, 2017 17:40
-
-
Save sonicparke/9e8369579dd98d3c688de4a450b51adc to your computer and use it in GitHub Desktop.
Setting Up the Angular CLI in Visual Studio for Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.Use(async (context, next) => | |
{ | |
await next(); | |
// If there’s no available file and the request doesn’t contain an extension, we’re probably trying to access a page. | |
// Rewrite request to use app root | |
if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value) && !context.Request.Path.Value.StartsWith(“/api”)) | |
{ | |
context.Request.Path = “/index.html”; | |
context.Response.StatusCode = 200; // Make sure we update the status code, otherwise it returns 404 | |
await next(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment