Pushing up initial version of Rest.Net.
This commit is contained in:
11
Rest.Net.Example/.vs/Rest.Net.Example/project-colors.json
Normal file
11
Rest.Net.Example/.vs/Rest.Net.Example/project-colors.json
Normal 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
|
||||
}
|
BIN
Rest.Net.Example/.vs/Rest.Net.Example/v17/.suo
Normal file
BIN
Rest.Net.Example/.vs/Rest.Net.Example/v17/.suo
Normal file
Binary file not shown.
25
Rest.Net.Example/Rest.Net.Example.sln
Normal file
25
Rest.Net.Example/Rest.Net.Example.sln
Normal 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
|
6
Rest.Net.Example/Rest.Net.Example/App.config
Normal file
6
Rest.Net.Example/Rest.Net.Example/App.config
Normal 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>
|
58
Rest.Net.Example/Rest.Net.Example/Program.cs
Normal file
58
Rest.Net.Example/Rest.Net.Example/Program.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
36
Rest.Net.Example/Rest.Net.Example/Properties/AssemblyInfo.cs
Normal file
36
Rest.Net.Example/Rest.Net.Example/Properties/AssemblyInfo.cs
Normal 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")]
|
56
Rest.Net.Example/Rest.Net.Example/Rest.Net.Example.csproj
Normal file
56
Rest.Net.Example/Rest.Net.Example/Rest.Net.Example.csproj
Normal 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>
|
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Newtonsoft.Json.dll
Normal file
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Newtonsoft.Json.dll
Normal file
Binary file not shown.
11305
Rest.Net.Example/Rest.Net.Example/bin/Debug/Newtonsoft.Json.xml
Normal file
11305
Rest.Net.Example/Rest.Net.Example/bin/Debug/Newtonsoft.Json.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.Example.exe
Normal file
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.Example.exe
Normal file
Binary file not shown.
@ -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>
|
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.Example.pdb
Normal file
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.Example.pdb
Normal file
Binary file not shown.
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.dll
Normal file
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.dll
Normal file
Binary file not shown.
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.pdb
Normal file
BIN
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.pdb
Normal file
Binary file not shown.
16
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.xml
Normal file
16
Rest.Net.Example/Rest.Net.Example/bin/Debug/Rest.Net.xml
Normal 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>
|
@ -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")]
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
d0276b4748a99240167b771cb4684c9f3cd78e60
|
@ -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
|
BIN
Rest.Net.Example/Rest.Net.Example/obj/Debug/Rest.Net.Example.exe
Normal file
BIN
Rest.Net.Example/Rest.Net.Example/obj/Debug/Rest.Net.Example.exe
Normal file
Binary file not shown.
BIN
Rest.Net.Example/Rest.Net.Example/obj/Debug/Rest.Net.Example.pdb
Normal file
BIN
Rest.Net.Example/Rest.Net.Example/obj/Debug/Rest.Net.Example.pdb
Normal file
Binary file not shown.
Reference in New Issue
Block a user