/*\ * * C:\WINDOWS\system32>netsh http add urlacl url="http://+:8080/" user="******" * URL reservation successfully added * C:\WINDOWS\system32> * * * https://github.com/NancyFx/Nancy/wiki/Self-Hosting-Nancy * http://www.codeproject.com/Articles/694907/Lift-your-Petticoats-with-Nancy * http://stackoverflow.com/questions/6845772/rest-uri-convention-singular-or-plural-name-of-resource-while-creating-it */ public PiscesWebRoutes() { Get["/"] = x => { return(WebPageBuilder.BuildHomePage()); }; Get["/series/(?<tablename>^[A-Za-z0-9_]{1,40}$)"] = x => { var fmt = this.Request.Query["format"].ToString(); DateTime start = Convert.ToDateTime(Request.Query["start"].ToString()); DateTime end = Convert.ToDateTime(Request.Query["end"].ToString()); var tablename = x.tablename.ToString(); DataTable tbl = Database.GetSeriesData(tablename, start, end); return(FormatDataTable(fmt, tbl)); }; Get["/series/"] = x => { var fmt = this.Request.Query["format"].ToString(); var id = x.id.ToString(); DataTable tbl = Database.GetSeries(); return(FormatDataTable(fmt, tbl)); }; Get["/sites/(?<siteid>^[A-Za-z0-9]{1,40}$)"] = x => { // list paramters for a site, and other stuff? var fmt = this.Request.Query["format"].ToString(); var siteid = x.siteid.ToString(); var tbl = Database.GetParameters(siteid); DataTable tbl2 = Database.GetSiteProperties(siteid); return(FormatDataTable(fmt, tbl) + "\n<br>" + FormatDataTable(fmt, tbl2)); }; Get["/sites"] = x => { var fmt = this.Request.Query["format"].ToString(); var sites = Database.Sites; return(FormatDataTable(fmt, sites)); }; Get["/types"] = x => { //var fmt = this.Request.Query["format"].ToString(); //var types = Database.Types; return(WebPageBuilder.BuildTypesPage()); // FormatDataTable(fmt, types); }; Get["/types/(?<typename>^[A-Za-z0-9]{1,40}$)"] = x => { // list paramters for a site, and other stuff? var fmt = this.Request.Query["format"].ToString(); var typeName = x.typename.ToString(); var sites = Database.GetSiteByType(typeName); return(FormatDataTable(fmt, sites)); }; Get["/query"] = x => { var fmt = this.Request.Query["format"].ToString(); var siteList = Database.Sites; return(WebPageBuilder.BuildQueryPage(siteList)); }; Get["/region"] = x => { //var fmt = this.Request.Query["format"].ToString(); //var types = Database.Types; return(WebPageBuilder.BuildRegionsPage());// FormatDataTable(fmt, types); }; Get["/region/(?<regionname>^[A-Za-z0-9]{1,40}$)"] = x => { // list paramters for a site, and other stuff? var fmt = this.Request.Query["format"].ToString(); var typeName = x.regionname.ToString(); var sites = Database.GetSiteByRegion(typeName); return(FormatDataTable(fmt, sites)); }; }