Created
May 4, 2011 13:51
-
-
Save jagregory/955248 to your computer and use it in GitHub Desktop.
Watch out NancyFX!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Api : Restish | |
{ | |
Api() | |
{ | |
Get("/customers", (req, res) => | |
{ | |
return View(new[] | |
{ | |
new { name = "Charles" } | |
}); | |
}); | |
Post("/customers", (req, res) => | |
{ | |
// save customers here | |
return Redirect("/customers"); | |
}).WithFilter<Authorize>(); | |
Delete("/customers/{id}", (req, res) => | |
{ | |
// delete customer here | |
return Redirect("/customers"); | |
}).WithFilter<Authorize>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am familiar with rest :)
This was a 5 minute hack to see if I could get it working on top of MVC1, with an even quicker example, not a example of a good rest api.