scottoffen / grapevine-legacy

Embedding A REST Server In Your Application Should Be Simple
http://scottoffen.github.io/grapevine-legacy/
Apache License 2.0
209 stars 51 forks source link

HttpMethod.GET issue - not found #211

Closed 123uyt closed 5 years ago

123uyt commented 5 years ago

I started trying out grapevine with documentation and ran into an issue with HttpMethod.GET does not contain definition GET. Setting "GET" to Get causes another issue, so I wonder is this something on my part? I have all my name spaces, and I have right nuGet installed grapevine.core since i'm using core 3

code:

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using Grapevine.Core.Server.Attributes;
using Grapevine.Core.Interfaces.Server;
using Grapevine.Core.Server;

namespace ConsoleApp12
{
    [RestResource]
    public class TestResource
    {
        [RestRoute(HttpMethod = HttpMethod.GET, PathInfo = "/repeat")]
        public IHttpContext RepeatMe(IHttpContext context)
        {
            var word = context.Request.QueryString["word"] ?? "what?";
            context.Response.SendResponse(word);
            return context;
        }

        [RestRoute]
        public IHttpContext HelloWorld(IHttpContext context)
        {
            context.Response.SendResponse("Hello, world.");
            return context;
        }
    }
}
scottoffen commented 5 years ago

What is the problem you are actually having? What is the error message and when do you see it?

scottoffen commented 5 years ago

Grapevine.Core is not this repository. That is not this project. I don't know who that is.

However, if you remove using System.Net.Http;, and instead use the HttpMethod enum that ships with Grapevine, your route should then be found.