Port specified by command line argument
This commit is contained in:
parent
4edd94b302
commit
1288682766
1 changed files with 8 additions and 1 deletions
|
@ -12,6 +12,12 @@ namespace SAPIServer
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
if (args.Length < 1 || !ushort.TryParse(args[0], out var port))
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine("Usage: SAPIServer.exe <port>");
|
||||||
|
Environment.Exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var http = new HTTPServer();
|
var http = new HTTPServer();
|
||||||
http.Get("/api/voices", ctx =>
|
http.Get("/api/voices", ctx =>
|
||||||
{
|
{
|
||||||
|
@ -61,7 +67,8 @@ namespace SAPIServer
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
http.Listen(8080);
|
Console.WriteLine($"[{ DateTime.Now:u}] Starting HTTP server on port {port}");
|
||||||
|
http.Listen(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue