public void Setup(Action <Func <AppFunc, AppFunc> > use) { use(Statics.AddFileAlias("/index.html", "/") .AddFolder("/css") .AddFolderAlias("/assets/images", "/images") .AddFolderAlias("/Scripts", "/js/vendor") .UseCharSet(Encoding.UTF8)); }
public static void Setup(UseAction use) { //use(HttpsOnly.Create()); use(Statics.AddFileAlias("/index.html", "/") .AddFolder("/scripts") .AddFolder("/content") .AddFolder("/html") .AddFolder("/App")); use(Application.Run); }
public void ReturnsAliasFileWithTrailingSlash() { using (var stream = new MemoryStream()) { const string path = "/Files/index.html"; var env = CreateEnv("/foo/", stream); var app = Statics.AddFileAlias(path, "/foo").Build()(Complete); app(env).Wait(); stream.Position = 0; var text = ReadStream(stream); Assert.Equal("<h1>Pass</h1>", text); } }
static void Main(string[] args) { var app = new Fixer().Use( Statics.AddFileAlias("/index.html", "/") .AddFolder("/css") .AddFolderAlias("/assets/images", "/images") .AddFolderAlias("/Scripts", "/js/vendor") ).Build(); using (var server = Nowin.ServerBuilder.New().SetPort(8282).SetOwinApp(app).Build()) { server.Start(); Console.WriteLine("Running. Press ENTER to stop."); Console.ReadLine(); } }
/// <summary> /// Called by Fix to let you set up your application /// </summary> /// <param name="use">Function to add middleware or apps to the pipeline.</param> /// <param name="map">Function to add middleware or apps only for URLs with a certain prefix.</param> /// <remarks>We have to use the <c>map</c> function to restrict SignalR otherwise it goes batshit and complains about protocols in every response.</remarks> public void Setup(UseAction use, MapAction map) { map("/signalr", OwinSignalR.Hub(_startupEnv)); use(Statics.AddFileAlias("/index.html", "/").AddFolder("/Scripts")); }