Q:

Develop WebAPI using mono

Is there any guide or documentation to build a REST API using Mono console or MonoDevelop. I tried to create MVC application in MonoDevelop however couldn't find App_Start/WebApiConfig.cs or relevant files by which I can define routes and other settings which I usually do in Visual studio based application.

A:

Short answer is there is no template in MD for this, however it's very easy to get going:

Create a new ASP.NET Project (the bottom project in the MD ASP.NET project templates).
Use NuGet to add ASP.NET Web API 2.2.
Add an App_Start folder manually, and a WebApiConfig.cs with your routes etc. 

Something like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

namespace MyWebApi
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // TODO: Add any additional configuration code.

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
    }
}

Add WebApiConfig configuration into the Global.asax.cs

For example:
protected void Application_Start (Object sender, EventArgs e)
{
    GlobalConfiguration.Configure(WebApiConfig.Register);
}

Then start adding your models and controllers etc. as usual.

Hope this help, M.

A:

I followed the instructions given in @muszeo's answer and it worked. 
I've created a sample project at https://github.com/sashoalm/HelloWebApi. It defines a single controller called HelloWebApiController, which creates an endpoint at http://localhost:8080/api/HelloWebApi that returns a string with "hello, world". 
I've tested it on Linux with MonoDevelop 5.10.
You can clone it using git clone https://github.com/sashoalm/HelloWebApi.git

