I'm trying to set up a route for POST Nancy, where I want to send an object in Json format and use it to trigger an event in the Unity runtime — what I thought should be pretty standard.
I thought that following an example in NancyFX: Deserialize JSON , I could bind the request body to an object and then use it elsewhere, however, I really get this rather cryptic error:
Error CS1061: Type 'server.RESTServer' does not contain a definition for 'Bind' and no extension method 'Bind' of type 'server.RESTServer' could be found (are you missing a using directive or an assembly reference?) (CS1061) (server)
This is the relevant section from the intruder:
using Nancy; namespace server { public class RESTServer : Nancy.NancyModule, RESTInterface { public class LevelInfo { public string index; } public RESTServer () { Delete ["/current/level"] = _ => { UnloadLevel(); return HttpStatusCode.OK; }; Get ["/current/level"] = _ => Level; Post ["/current/level"] = _ => { LevelInfo body = this.Bind<LevelInfo>();
Information about my version of Mono / Monodevelop on pastebin is here , and the build browser also displays this, also related to pastebin, for Nancy.
I usually don’t do a lot of .net development, so I'm sure this is something really simple, but I already lost a day trying to solve this problem ... Any help would be greatly appreciated.
source share