| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace System.Net.ApiService {
- public enum HttpMethod:byte {
- GET = 1,
- PUT = 2,
- POST = 4,
- DELETE = 8,
- PATCH = 16,
- TRACE = 32,
- OPTIONS = 64,
- CONNECT = 128
- }
- [System.AttributeUsage(System.AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
- public class Route : System.Attribute {
- private string _path;
- private HttpMethod _methode;
- //TODO: Regex Pattern for route
- public Route(string Path) {
- if (!Path.StartsWith("/"))
- Path = "/" + Path;
- if (Path.EndsWith("/") && Path.Length > 1)
- Path = Path.Substring(0, Path.Length - 1);
- this._path = Path;
- this._methode = HttpMethod.GET | HttpMethod.POST;
- }
- public Route(string Path, HttpMethod Method) {
- this._path = Path;
- this._methode = Method;
- }
- public string Path {
- get {
- return this._path;
- }
- }
- public HttpMethod Method {
- get {
- return this._methode;
- }
- }
- }
- }
|