コード例 #1
0
ファイル: Global.asax.cs プロジェクト: tonybonura/Nano
        public static void StartupNano(HttpApplication httpApplication)
        {
            // Get NanoConfiguration used by the demo projects. Replace this with your own code.
            var config = NanoConfigurationHelper.GetNanoConfiguration();

            config.RequestHandlers.Remove(config.RequestHandlers.First(handler => handler.UrlPath == "/"));
            config.AddDirectory("/", "www", returnHttp404WhenFileWasNotFound: false);

            // Specify your application name. A reasonable default is automatically used if not
            // supplied but it's definitely recommended to supply one.
            config.ApplicationName = "Nano.Demo.AspNet";

            SystemWebNanoServer.Start(httpApplication, config);
        }
コード例 #2
0
ファイル: NanoWebStartup.cs プロジェクト: lizhengzhou/Nano
        public static void Start(HttpApplication httpApplication)
        {
            var config = new NanoConfiguration();

            config.GlobalEventHandler.PreInvokeHandlers.Add(context =>
            {
            });

            var eventHandler = new EventHandler();

            eventHandler.PreInvokeHandlers.Add(context =>
            {
            });

            eventHandler.PostInvokeHandlers.Add(context =>
            {
            });

            eventHandler.UnhandledExceptionHandlers.Add((exception, context) =>
            {
            });

            config.AddMethods <Customer>(); // methods will be added under '/api/customer/'

            config.AddFile("/home", @"\www\home\index.html");

            config.AddFunc("/hi", x => "Hello World! " + x.Request.Url);

            config.AddFunc("/howdy", x =>
            {
                var model = x.Bind <Person>("person");
                return(model);
            });

            config.EnableCors();

            config.AddFunc("/probe", context => true);
            config.AddFunc("/monitoring/probe", context => true);

            config.AddDirectory("/", @"\www\");

            SystemWebNanoServer.Start(httpApplication, config);
        }