Skip to content

Instantly share code, notes, and snippets.

@SlyW
Created May 15, 2018 20:47
Show Gist options
  • Save SlyW/3a55dac086453fef76bb95b55abcf4fb to your computer and use it in GitHub Desktop.
Save SlyW/3a55dac086453fef76bb95b55abcf4fb to your computer and use it in GitHub Desktop.
Super Simple API Routing
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace SuperSimpleWebAPI.Controllers
{
[RoutePrefix("Grammar")]
public class GrammarController : ApiController
{
[Route("")]
[HttpGet]
public IHttpActionResult Get() { return Ok("Hello World"); }
[Route("{Dialog}")]
[HttpGet]
public IHttpActionResult Get(String Dialog) { return Ok("Hello World - " + Dialog); }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment