示例#1
0
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));
            nancyHost.Start();

            Console.ReadLine();
            nancyHost.Stop();
        }
示例#2
0
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8081"), new TodoMvcBootstrap());
            nancyHost.Start();

            Console.ReadLine();
            nancyHost.Stop();
        }
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));

            nancyHost.Start();
            Console.WriteLine("NancyFX API running");
            Console.ReadLine();
            nancyHost.Stop();
        }
示例#4
0
 static void Main(string[] args)
 {
     var host = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8888/Nancy/"));
     host.Start();
     Process.Start("http://localhost:8888/Nancy/");
     Console.WriteLine("Press [ENTER] to stop");
     Console.ReadLine();
     host.Stop();
 }
示例#5
0
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));
            nancyHost.Start();

            Console.WriteLine("Serving... - until being killed");
            Console.ReadLine();

            nancyHost.Stop();
        }
示例#6
0
 static void Main()
 {
     using (var host = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234")))
     {
         host.Start();
         Console.WriteLine("Running on http://localhost:1234");
         new LasModules();
         Console.ReadLine();
         host.Stop();
     }
 }
示例#7
0
        static void Main(string[] args)
        {
            var hostUrl = "http://localhost:" + ConfigurationManager.AppSettings["Port"];
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(hostUrl));
            nancyHost.Start();

            Console.WriteLine("Nancy host listening on " + hostUrl);

            Console.ReadLine();
            nancyHost.Stop();
        }
示例#8
0
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:9664"));
             nancyHost.Start();
             Console.WriteLine("Web server running...");

            Process.Start("http://localhost:9664");

             Console.ReadLine();
             nancyHost.Stop();
        }
示例#9
0
        static void Main(string[] args)
        {
            var hostUrl   = "http://localhost:" + ConfigurationManager.AppSettings["Port"];
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(hostUrl));

            nancyHost.Start();

            Console.WriteLine("Nancy host listening on " + hostUrl);

            Console.ReadLine();
            nancyHost.Stop();
        }
示例#10
0
 public static void Main(string[] args)
 {
     var config = new Nancy.Hosting.Self.HostConfiguration();
     config.UnhandledExceptionCallback += (ex) => {
         Console.WriteLine(ex);
     };
     var nancyHost = new Nancy.Hosting.Self.NancyHost(config, new Uri("http://localhost:7000"));
     nancyHost.Start();
     Console.ReadLine();
     nancyHost.Stop();
     System.Threading.Thread.Sleep(1000);
 }
示例#11
0
        static void Main(string[] args)
        {
            __exit = new AutoResetEvent(false);

            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));
            nancyHost.Start();

            Console.WriteLine("Serving...");
            __exit.WaitOne();

            nancyHost.Stop();
        }
        static void Main(string[] args)
        {
            var port      = 8765;
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:" + port));

            Console.WriteLine("Running port: {0}", port);

            nancyHost.Start();

            Console.ReadKey();

            nancyHost.Stop();
        }
示例#13
0
        static void Main(string[] args)
        {
            string httpUrl      = "http://0.0.0.0:9664";
            string websocketUrl = "ws://0.0.0.0:9966";

            if (OperatingSystem.IsWindows())
            {
                httpUrl      = "http://127.0.0.1:9664";
                websocketUrl = "ws://127.0.0.1:9966";
            }
            var tokenSource      = new CancellationTokenSource();
            CancellationToken ct = tokenSource.Token;

            if (args.Length > 0)
            {
                r2warsStatic.torneo.SetWarriorsDirectory(args[0]);
            }

            var taskA = new Task(() =>
            {
                var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(httpUrl), new CustomBootstrapper());
                nancyHost.Start();
                Console.WriteLine("Web server running at " + httpUrl);

                Process.Start(httpUrl);


                while (!ct.IsCancellationRequested)
                {
                    Thread.Sleep(1000);
                }
                nancyHost.Stop();
            }, tokenSource.Token);

            var taskB = new Task(() =>
            {
                var wssv = new WebSocketServer(websocketUrl);
                wssv.AddWebSocketService <r2warsWebSocket>("/r2wars");
                wssv.Start();
                while (!ct.IsCancellationRequested)
                {
                    Thread.Sleep(1000);
                }
                wssv.Stop();
            }, tokenSource.Token);

            taskA.Start();
            taskB.Start();
            Console.ReadKey();
            tokenSource.Cancel();
        }
        public TimesheetApp()
        {
            InitializeComponent();

            const string appAddress = "http://*****:*****@"Timesheet Standalone. Navigate to: " + appAddress;
            this.Load += (sender, args) => this.addressTextbox.Invoke(textUpdate); ;
            this.FormClosed += (sender, args) => nancyHost.Stop();
        }
        public TimesheetApp()
        {
            InitializeComponent();

            const string appAddress = "http://*****:*****@"Timesheet Standalone. Navigate to: " + appAddress;

            this.Load       += (sender, args) => this.addressTextbox.Invoke(textUpdate);;
            this.FormClosed += (sender, args) => nancyHost.Stop();
        }
示例#16
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            var configuration = new Mocha.BddConfiguration(); //TODO: unhardcode
            var harnessFile   = "harness.html";

            var sources = tests
                          .Select(t => t.Source)
                          .Distinct();

            //TODO: allow multiple roots / multiple configs / multiple projects
            var rootPath = PathFinder.FindRootDirectoryForFile(sources.First());

            HarnessBuilder.CreateHarnessFile(configuration, sources, rootPath, harnessFile);

            var hostConfig = new Nancy.Hosting.Self.HostConfiguration()
            {
                RewriteLocalhost = true,
                UrlReservations  = new Nancy.Hosting.Self.UrlReservations()
                {
                    CreateAutomatically = true
                }
            };
            var port = "8081"; //TODO: unhardcode
            var uri  = String.Format("http://localhost:{0}", port);

            var host = new Nancy.Hosting.Self.NancyHost(
                new Uri(uri),
                new NancySettingsBootstrapper(rootPath),
                hostConfig
                );

            host.Start();

            //Run phantom per harness
            var harnessUri    = uri + "/" + harnessFile;
            var phantomrunner = new PhantomRunner(frameworkHandle, tests);
            var phantomResult = phantomrunner.Run(harnessUri);

            phantomResult.Wait();

            host.Stop();
        }
示例#17
0
        static void Main(string[] args)
        {
            Console.WriteLine("--Welcome to OpenBank--");
            Console.WriteLine();
            Console.Write("Starting up...");

            System.Net.ServicePointManager.ServerCertificateValidationCallback = CertificateValidator;

            string port = ConfigurationManager.AppSettings["port"];

            using (var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(string.Concat("http://localhost:", port))))
            {
                nancyHost.Start();
                Console.WriteLine("success!");

                Console.WriteLine(string.Format("Server listening on port {0} and waiting for connections.", port));
                Console.WriteLine(string.Format("Navigate to http://localhost:{0}/ for help.", port));

                Wait();

                nancyHost.Stop();
            }
        }
示例#18
0
        static void Main(string[] args)
        {
            Uri domainUri = null;

            try
            {
                domainUri = new Uri("http://localhost:8088");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Environment.Exit(0);
            }

            // create a new self-host server
            var nancyHost = new Nancy.Hosting.Self.NancyHost(domainUri);

            // start
            nancyHost.Start();
            Console.WriteLine("REST service listening on " + DOMAIN);
            // stop with an <Enter> key press
            Console.ReadLine();
            nancyHost.Stop();
        }
示例#19
0
 public static void StopHost()
 {
     _host.Stop();
 }