As long as you're just working on JavaScript code for the front end, wouldn't it make sense to write this in node? That way you can avoid context switching. I'd daresay this would be much simpler in JavaScript as well, to the point that a tutorial isn't really necessary.
Here's a quick take. I'm sure it can be cleaned up further. I've also taken the liberty of fixing the delete before post id bug.
You don't need attributes based routing in this example. Convention based routing is built into WebAPI.
For the Delete method you can return an HttpStatusCode instead of throwing an exception.
public IHttpActionResult Delete(int Id)
{
var result = (from b in ourbooks
where b.Id == Id
select b).FirstOrDefault();
ourbooks.Remove(result);
return StatusCode(HttpStatusCode.Accepted);
}
i've been using apiary this week and it's been absolutely fantastic so far. Markdown goes in, API docs + mock live API comes out, even syncs with github.
it's definitely a great tool, it's really useful being able to chop and change in the early stages of designing an API without being committed in the code.
Does anyone know of a similar guide for Ruby?
I'm an ASP.net developer and I'm trying to get some insight into other (perhaps quicker/easier) ways of doing exactly what this guide describes.
That's the first time I've heard that meaning of "self hosted." I was expecting something like a REST server that also acted as a client to another instance of itself.
Comments
As long as you're just working on JavaScript code for the front end, wouldn't it make sense to write this in node? That way you can avoid context switching. I'd daresay this would be much simpler in JavaScript as well, to the point that a tutorial isn't really necessary.
Here's a quick take. I'm sure it can be cleaned up further. I've also taken the liberty of fixing the delete before post id bug.
You can allow non-administrator access using netsh[1] as an administrator. That way you don't need to run VS as admin.
You don't need attributes based routing in this example. Convention based routing is built into WebAPI.For the Delete method you can return an HttpStatusCode instead of throwing an exception.
Also check out the OWIN self host tutorial [2].[1] https://github.com/NancyFx/Nancy/wiki/Hosting-nancy-with-owi...
[2] http://www.asp.net/web-api/overview/hosting-aspnet-web-api/u...
Is the normal way to returning "success" values (throwing an exception?)
Apiary is also a good option ( http://apiary.io).
i've been using apiary this week and it's been absolutely fantastic so far. Markdown goes in, API docs + mock live API comes out, even syncs with github.
it's definitely a great tool, it's really useful being able to chop and change in the early stages of designing an API without being committed in the code.
Does anyone know of a similar guide for Ruby? I'm an ASP.net developer and I'm trying to get some insight into other (perhaps quicker/easier) ways of doing exactly what this guide describes.
There was an REST server that responded with just a json you specify for a particular url, but god i can't recall the name.
Tho, http://requestb.in/ is a superb tool as well as https://www.runscope.com if you need more power.
p.s. this one too : http://httpbin.org/
excellent! thanks!
-bowerbird
https://github.com/typicode/json-server
That's the first time I've heard that meaning of "self hosted." I was expecting something like a REST server that also acted as a client to another instance of itself.