Pushing up initial version of Rest.Net.

This commit is contained in:
2022-02-06 19:22:24 -08:00
parent 7bac946ea3
commit dd82897982
68 changed files with 97993 additions and 0 deletions

View File

@ -0,0 +1,11 @@
{
"Version": 1,
"ProjectMap": {
"d476199d-526a-4831-866f-790676f8bc37": {
"ProjectGuid": "d476199d-526a-4831-866f-790676f8bc37",
"DisplayName": "Rest.Net.Example",
"ColorIndex": 0
}
},
"NextColorIndex": 1
}

Binary file not shown.

View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rest.Net.Example", "Rest.Net.Example\Rest.Net.Example.csproj", "{D476199D-526A-4831-866F-790676F8BC37}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D476199D-526A-4831-866F-790676F8BC37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D476199D-526A-4831-866F-790676F8BC37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D476199D-526A-4831-866F-790676F8BC37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D476199D-526A-4831-866F-790676F8BC37}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {15F2CFE4-AA3C-4D24-BD82-FA12BDA760E6}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Rest.Net;
namespace Rest.Net.Example
{
public class Program
{
public class User
{
public string Name = null;
public User(string name)
{
this.Name = name;
}
public static explicit operator User(string input)
{
return new User(input.ToString());
}
}
public static void Main(string[] args)
{
var listener = new RouteListener(8080,
new Route(HttpRequestMethod.Get, "/status", Status),
new Route<double, double>(HttpRequestMethod.Post, "/add/{a}/{b}", Add),
new Route<User>(HttpRequestMethod.Post, "/signup/{username}", Signup)
);
listener.Start();
Console.WriteLine($"Rest api server running at http://localhost:{listener.Port}");
listener.Block();
}
public static HttpListenerResponse Status(HttpListenerRequest request, HttpListenerResponse response)
{
return response.WithStatus(HttpStatusCode.OK).WithText("Everything is operational.");
}
public static HttpListenerResponse Add(HttpListenerRequest request, HttpListenerResponse response, double a, double b)
{
return response.WithStatus(HttpStatusCode.OK).WithText((a + b).ToString());
}
public static HttpListenerResponse Signup(HttpListenerRequest request, HttpListenerResponse response, User user)
{
return response.WithStatus(HttpStatusCode.OK).WithText("User:" + user.Name);
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rest.Net.Example")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rest.Net.Example")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d476199d-526a-4831-866f-790676f8bc37")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D476199D-526A-4831-866F-790676F8BC37}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Rest.Net.Example</RootNamespace>
<AssemblyName>Rest.Net.Example</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Rest.Net">
<HintPath>..\..\Rest.Net\Rest.Net\bin\Debug\Rest.Net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Rest.Net</name>
</assembly>
<members>
<member name="T:Rest.Net.HttpRequestMethod">
<summary>
An enum containing the available http request methods.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
</summary>
</member>
<!-- Badly formed XML comment ignored for member "M:Rest.Net.RouteMatcher.Matches(System.String,System.String,System.String[]@)" -->
</members>
</doc>

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@ -0,0 +1 @@
d0276b4748a99240167b771cb4684c9f3cd78e60

View File

@ -0,0 +1,14 @@
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Rest.Net.Example.exe.config
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Rest.Net.Example.exe
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Rest.Net.Example.pdb
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Rest.Net.dll
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Newtonsoft.Json.dll
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Rest.Net.pdb
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Rest.Net.xml
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\bin\Debug\Newtonsoft.Json.xml
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\obj\Debug\Rest.Net.Example.csproj.AssemblyReference.cache
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\obj\Debug\Rest.Net.Example.csproj.SuggestedBindingRedirects.cache
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\obj\Debug\Rest.Net.Example.csproj.CoreCompileInputs.cache
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\obj\Debug\Rest.Net.Example.csproj.CopyComplete
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\obj\Debug\Rest.Net.Example.exe
C:\Users\Matt\Desktop\Rest.Net\Rest.Net.Example\Rest.Net.Example\obj\Debug\Rest.Net.Example.pdb